Improve haddock docstrings
This commit is contained in:
parent
d8ed744f2f
commit
93dccd42fe
@ -1,5 +1,6 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
|
-- | Diceware dictionary interface
|
||||||
module Alea.Diceware where
|
module Alea.Diceware where
|
||||||
|
|
||||||
import Data.Monoid ((<>))
|
import Data.Monoid ((<>))
|
||||||
@ -13,7 +14,8 @@ import qualified Data.Text as T
|
|||||||
type Diceware = [Text]
|
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 :: Int -> Int -> IO [Int]
|
||||||
randIndices n k = take k <$> randomRs (0, n-1) <$> newStdGen
|
randIndices n k = take k <$> randomRs (0, n-1) <$> newStdGen
|
||||||
|
|
||||||
@ -36,6 +38,7 @@ readDiceware' d n = d !! n
|
|||||||
|
|
||||||
|
|
||||||
-- | Dice numbers to numbers
|
-- | Dice numbers to numbers
|
||||||
|
--
|
||||||
-- > fromDice 11121 == Just 6
|
-- > fromDice 11121 == Just 6
|
||||||
fromDice :: Int -> Maybe Int
|
fromDice :: Int -> Maybe Int
|
||||||
fromDice n = elemIndex n (filter isDice [11111..66666])
|
fromDice n = elemIndex n (filter isDice [11111..66666])
|
||||||
|
Loading…
Reference in New Issue
Block a user