packages feed

alea 0.5.0.0 → 0.5.1.0

raw patch · 3 files changed

+11/−2 lines, 3 files

Files

alea.cabal view
@@ -1,5 +1,5 @@ name:                alea-version:             0.5.0.0+version:             0.5.1.0 synopsis:            a diceware passphrase generator description: 
src/Alea/Diceware.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} +-- | Diceware dictionary interface module Alea.Diceware where  import Data.Monoid   ((<>))@@ -13,7 +14,8 @@ type Diceware = [Text]  --- | Produces k random indices to be extracted+-- | @Randindices n k@ produces @k@ random indices of words+-- to be extracted from a 'Diceware' of @n@ words randIndices :: Int -> Int -> IO [Int] randIndices n k = take k <$> randomRs (0, n-1) <$> newStdGen @@ -36,6 +38,7 @@   -- | Dice numbers to numbers+-- -- > fromDice 11121 == Just 6 fromDice :: Int -> Maybe Int fromDice n = elemIndex n (filter isDice [11111..66666])
src/Main.hs view
@@ -1,4 +1,6 @@ {-# LANGUAGE RecordWildCards #-}+-- | Main module+module Main where  import Control.Monad             (when, forever) import Data.Text                 (unpack)@@ -26,18 +28,22 @@ options = Options    <$> switch       ( long "interactive"+     <> short 'i'      <> help "Manually insert numbers from a dice" )   <*> optional (option auto       ( long "dictionary"+     <> short 'd'      <> metavar "FILEPATH"      <> help "Specify dictionary filepath" ))   <*> option auto       ( long "length"+     <> short 'l'      <> value 6      <> metavar "N"      <> help "Number of words in a passphrase")   <*> option auto      ( long "phrases"+    <> short 'p'     <> value 1     <> metavar "M"     <> help "Number of passphrases to generate" )