Fix whitespace mess
This commit is contained in:
parent
696c74e408
commit
73093e4e29
28
main.hs
28
main.hs
@ -10,11 +10,11 @@ import Alea.Diceware
|
|||||||
import Alea.Random
|
import Alea.Random
|
||||||
|
|
||||||
data ProgArgs = ProgArgs
|
data ProgArgs = ProgArgs
|
||||||
{ interactive :: Bool
|
{ interactive :: Bool
|
||||||
, dictionary :: FilePath
|
, dictionary :: FilePath
|
||||||
, phraseLength :: Int
|
, phraseLength :: Int
|
||||||
, phrases :: Int
|
, phrases :: Int
|
||||||
} deriving (Show)
|
} deriving (Show)
|
||||||
|
|
||||||
parser :: IO (ParserSpec ProgArgs)
|
parser :: IO (ParserSpec ProgArgs)
|
||||||
parser = path >>= \path -> return $ ProgArgs
|
parser = path >>= \path -> return $ ProgArgs
|
||||||
@ -44,12 +44,12 @@ readDict args@ProgArgs{..} =
|
|||||||
-- Main function
|
-- Main function
|
||||||
exec :: ProgArgs -> IO ()
|
exec :: ProgArgs -> IO ()
|
||||||
exec args@ProgArgs{..} =
|
exec args@ProgArgs{..} =
|
||||||
if interactive
|
if interactive
|
||||||
then interact (unlines . map dice . lines)
|
then interact (unlines . map dice . lines)
|
||||||
else do
|
else do
|
||||||
randWords dictSize phraseLength >>= putStrLn . unwords . map dice'
|
randWords dictSize phraseLength >>= putStrLn . unwords . map dice'
|
||||||
when (phrases > 1) $ exec args {phrases = phrases - 1}
|
when (phrases > 1) $ exec args {phrases = phrases - 1}
|
||||||
where
|
where
|
||||||
(dict, dictSize) = (parseDiceware dictionary, length dict)
|
(dict, dictSize) = (parseDiceware dictionary, length dict)
|
||||||
dice n = readDiceware dict (read n :: Int)
|
dice n = readDiceware dict (read n :: Int)
|
||||||
dice' n = readDiceware' dict n
|
dice' n = readDiceware' dict n
|
||||||
|
Loading…
Reference in New Issue
Block a user