replace m >>= return . f with fmap f m

This commit is contained in:
Rnhmjoj 2015-01-08 00:28:44 +01:00
parent 5880d11869
commit 7d95a3730c

View File

@ -17,11 +17,12 @@ data ProgArgs = ProgArgs
} deriving (Show)
parser :: IO (ParserSpec ProgArgs)
parser = path >>= \path -> return $ ProgArgs
parser = (\path -> ProgArgs
`parsedBy` boolFlag "interactive" `Descr` "Manually insert numbers"
`andBy` optFlag path "dictionary" `Descr` "Specify dictionary file path"
`andBy` optFlag 6 "lenght" `Descr` "Number of words in a passphrase"
`andBy` optFlag 1 "phrases" `Descr` "Number of passphrases to generate"
`andBy` optFlag 1 "phrases" `Descr` "Number of passphrases to generate")
<$> path
interface :: IO (CmdLnInterface ProgArgs)
interface =
@ -39,7 +40,7 @@ path = getDataFileName "dict/diceware"
-- Read dictionary file
readDict :: ProgArgs -> IO ProgArgs
readDict args@ProgArgs{..} =
readFile dictionary >>= \x -> return args {dictionary = x}
(\x -> args {dictionary = x}) <$> readFile dictionary
-- Main function
exec :: ProgArgs -> IO ()