packages feed

alea 0.2.0.0 → 0.2.1.0

raw patch · 2 files changed

+10/−12 lines, 2 files

Files

Main.hs view
@@ -9,7 +9,7 @@ import Alea.Random  _NAME = "Alea"-_VERSION = "0.2.0"+_VERSION = "0.2.1" _INFO = _NAME ++ " version " ++ _VERSION _ABOUT = "a diceware passphrase generator" _COPYRIGHT = "(C) Michele Guerini Rocco 2014"@@ -44,12 +44,11 @@ -- Assign default values to unspecified args defaults :: Args -> IO Args defaults args@Args{..} = do-	defaultDict <- getDataFileName "dict/diceware" >>= readFile-	dict <- readFile dictionary-	return args-		{ dictionary   = if null dict then defaultDict else dict-		, phraseLength = if phraseLength == 0 then 6 else phraseLength-		}+	dictionary' <- if null dictionary+					then getDataFileName "dict/diceware" >>= readFile+					else readFile dictionary+	let phraseLength' = if phraseLength == 0 then 6 else phraseLength+	return args { dictionary = dictionary', phraseLength = phraseLength'}  -- Main function exec :: Args -> IO ()@@ -60,7 +59,6 @@ 			randWords dictSize phraseLength >>= putStrLn . unwords . map dice' 			when (phrases > 1) $ exec args {phrases = phrases - 1} 	where-		-- helpers-		dice  n = readDiceware  (parseDiceware dictionary) (read n :: Int)-		dice' n = readDiceware' (parseDiceware dictionary) n-		dictSize = length $ parseDiceware dictionary+		(dict, dictSize) = (parseDiceware dictionary, length dict)+		dice  n = readDiceware  dict (read n :: Int)+		dice' n = readDiceware' dict n
alea.cabal view
@@ -1,5 +1,5 @@ name:                alea-version:             0.2.0.0+version:             0.2.1.0 synopsis:            a diceware passphrase generator description: