Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- genPassword :: MonadRandom m => GenPasswordOpts -> m Word
- genPasswords :: MonadRandom m => GenPasswordOpts -> m [Word]
- genPasswords' :: MonadRandom m => GenPasswordOpts -> Int -> m [Word]
- genPassphrase :: MonadRandom m => GenPassphraseOpts -> m [Word]
- genPassphrase' :: MonadRandom m => GenPassphraseOpts -> Int -> m [Word]
- type Pass gen = PassT gen Identity
- runPass :: Pass gen a -> gen -> (a, gen)
- evalPass :: Pass gen a -> gen -> a
- usingPass :: gen -> Pass gen a -> (a, gen)
- newtype PassT gen m a = PassT {}
- runPassT :: PassT g m a -> g -> m (a, g)
- evalPassT :: Monad m => PassT g m a -> g -> m a
- usingPassT :: g -> PassT g m a -> m (a, g)
- module Control.Monad.Random
- data GenPasswordOpts = GenPasswordOpts {
- woptsCapitals :: !Bool
- woptsDigits :: !Bool
- woptsSpecials :: !Bool
- woptsTrigraph :: Trigraph
- woptsLength :: !Int
- data GenPassphraseOpts = GenPassphraseOpts {
- poptsCapitals :: !Bool
- poptsDigits :: !Bool
- poptsSpecials :: !Bool
- poptsTrigraph :: Trigraph
- poptsMinLength :: !Int
- poptsMaxLength :: !Int
- data Language
- newtype TrigraphConfig = TrigraphConfig {}
- newtype Trigraph = Trigraph {}
- newtype Word = Word {}
- newtype Unigram = Unigram {}
- data Digram = Digram Char Char
- data Trigram = Trigram Char Char Char
- newtype Frequency = Frequency {
- unFrequency :: Int
- newtype Frequencies = Frequencies {}
- data GibberishErr
- isTrigraphNotFound :: GibberishErr -> Bool
- isImpossibleError :: GibberishErr -> Bool
- genTrigraph :: [Text] -> Trigraph
- loadTrigraph :: Language -> IO Trigraph
Generating Passwords
genPassword :: MonadRandom m => GenPasswordOpts -> m Word Source #
Generate a password with the given options
genPasswords :: MonadRandom m => GenPasswordOpts -> m [Word] Source #
Generate passwords with the given options. Warning: Do not use with the IO monad,
instead use genPasswords'
genPasswords' :: MonadRandom m => GenPasswordOpts -> Int -> m [Word] Source #
Generating Passphrases
genPassphrase :: MonadRandom m => GenPassphraseOpts -> m [Word] Source #
Generate a passphrase with the given options. Warning: Do not use with the IO monad,
instead use genPassphrash'
genPassphrase' :: MonadRandom m => GenPassphraseOpts -> Int -> m [Word] Source #
Generate a passphrase with the given options and the given number of words.
The Pass Monad
type Pass gen = PassT gen Identity Source #
Password/Passphrase generation monad parameterized by the type gen
of the generator
to carry
runPass :: Pass gen a -> gen -> (a, gen) Source #
Run a generation computation with the given options and initial generator
evalPass :: Pass gen a -> gen -> a Source #
Evaluate a generation computation with the given options and initial generator, discarding the final generator
usingPass :: gen -> Pass gen a -> (a, gen) Source #
Shorter and more readable alias for flip runPassT
.
The PassT Monad Transformer
newtype PassT gen m a Source #
Password/Passphrase generation transformer monad parameterized by :
gen
- the generator.m
- the inner monad.
Instances
(RandomGen gen, Monad m) => MonadRandom (PassT gen m) Source # | |
Defined in Data.Gibberish.Monad.Pass | |
MonadFail m => MonadFail (PassT gen m) Source # | |
Defined in Data.Gibberish.Monad.Pass | |
MonadIO m => MonadIO (PassT gen m) Source # | |
Defined in Data.Gibberish.Monad.Pass | |
Monad m => Applicative (PassT gen m) Source # | |
Defined in Data.Gibberish.Monad.Pass | |
Functor m => Functor (PassT gen m) Source # | |
Monad m => Monad (PassT gen m) Source # | |
runPassT :: PassT g m a -> g -> m (a, g) Source #
Run a generation computation with the given options and initial generator
evalPassT :: Monad m => PassT g m a -> g -> m a Source #
Evaluate a generation computation with the given options and initial generator, discarding the final generator
usingPassT :: g -> PassT g m a -> m (a, g) Source #
Shorter and more readable alias for flip runPassT
.
module Control.Monad.Random
Core Types
data GenPasswordOpts Source #
Password generation options
GenPasswordOpts | |
|
Instances
Show GenPasswordOpts Source # | |
Defined in Data.Gibberish.Types showsPrec :: Int -> GenPasswordOpts -> ShowS # show :: GenPasswordOpts -> String # showList :: [GenPasswordOpts] -> ShowS # | |
Eq GenPasswordOpts Source # | |
Defined in Data.Gibberish.Types (==) :: GenPasswordOpts -> GenPasswordOpts -> Bool # (/=) :: GenPasswordOpts -> GenPasswordOpts -> Bool # |
data GenPassphraseOpts Source #
Passphrase generation options
GenPassphraseOpts | |
|
Instances
Show GenPassphraseOpts Source # | |
Defined in Data.Gibberish.Types showsPrec :: Int -> GenPassphraseOpts -> ShowS # show :: GenPassphraseOpts -> String # showList :: [GenPassphraseOpts] -> ShowS # | |
Eq GenPassphraseOpts Source # | |
Defined in Data.Gibberish.Types (==) :: GenPassphraseOpts -> GenPassphraseOpts -> Bool # (/=) :: GenPassphraseOpts -> GenPassphraseOpts -> Bool # |
A language indicating the dictionary that generated a trigraph
newtype TrigraphConfig Source #
A path to a trigraph json config file
Instances
Show TrigraphConfig Source # | |
Defined in Data.Gibberish.Types showsPrec :: Int -> TrigraphConfig -> ShowS # show :: TrigraphConfig -> String # showList :: [TrigraphConfig] -> ShowS # | |
Eq TrigraphConfig Source # | |
Defined in Data.Gibberish.Types (==) :: TrigraphConfig -> TrigraphConfig -> Bool # (/=) :: TrigraphConfig -> TrigraphConfig -> Bool # |
A trigraph is a mapping of all digrams to frequencies. That is, for a set of digrams, it contains the frequencies of all possible trigram candidates.
A natural language word
A unigram is a single letter
Instances
FromJSON Unigram Source # | |
Defined in Data.Gibberish.Types | |
FromJSONKey Unigram Source # | |
Defined in Data.Gibberish.Types | |
ToJSON Unigram Source # | |
ToJSONKey Unigram Source # | |
Defined in Data.Gibberish.Types | |
Show Unigram Source # | |
NFData Unigram Source # | |
Defined in Data.Gibberish.Types | |
Eq Unigram Source # | |
Ord Unigram Source # | |
A digram is a sequence of two letters
Instances
FromJSON Digram Source # | |
Defined in Data.Gibberish.Types | |
FromJSONKey Digram Source # | |
Defined in Data.Gibberish.Types | |
ToJSON Digram Source # | |
ToJSONKey Digram Source # | |
Defined in Data.Gibberish.Types | |
Generic Digram Source # | |
Show Digram Source # | |
NFData Digram Source # | |
Defined in Data.Gibberish.Types | |
Eq Digram Source # | |
Ord Digram Source # | |
TextShow Digram Source # | |
Defined in Data.Gibberish.Types | |
type Rep Digram Source # | |
Defined in Data.Gibberish.Types type Rep Digram = D1 ('MetaData "Digram" "Data.Gibberish.Types" "gibberish-3.0.0.0-CtpaXLVJUM23TyUN22m77c" 'False) (C1 ('MetaCons "Digram" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char))) |
A trigrams is a sequence of three letters
Instances
Generic Trigram Source # | |
Show Trigram Source # | |
NFData Trigram Source # | |
Defined in Data.Gibberish.Types | |
Eq Trigram Source # | |
Ord Trigram Source # | |
type Rep Trigram Source # | |
Defined in Data.Gibberish.Types type Rep Trigram = D1 ('MetaData "Trigram" "Data.Gibberish.Types" "gibberish-3.0.0.0-CtpaXLVJUM23TyUN22m77c" 'False) (C1 ('MetaCons "Trigram" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Char)))) |
A frequency represents the number of times a given trigram occurs in a language
Instances
FromJSON Frequency Source # | |
Defined in Data.Gibberish.Types | |
ToJSON Frequency Source # | |
Enum Frequency Source # | |
Defined in Data.Gibberish.Types succ :: Frequency -> Frequency # pred :: Frequency -> Frequency # fromEnum :: Frequency -> Int # enumFrom :: Frequency -> [Frequency] # enumFromThen :: Frequency -> Frequency -> [Frequency] # enumFromTo :: Frequency -> Frequency -> [Frequency] # enumFromThenTo :: Frequency -> Frequency -> Frequency -> [Frequency] # | |
Num Frequency Source # | |
Defined in Data.Gibberish.Types | |
Integral Frequency Source # | |
Defined in Data.Gibberish.Types | |
Real Frequency Source # | |
Defined in Data.Gibberish.Types toRational :: Frequency -> Rational # | |
Show Frequency Source # | |
NFData Frequency Source # | |
Defined in Data.Gibberish.Types | |
Eq Frequency Source # | |
Ord Frequency Source # | |
Defined in Data.Gibberish.Types |
newtype Frequencies Source #
Frequencies maps a unigram to a frequency
Instances
FromJSON Frequencies Source # | |
Defined in Data.Gibberish.Types parseJSON :: Value -> Parser Frequencies # parseJSONList :: Value -> Parser [Frequencies] # | |
ToJSON Frequencies Source # | |
Defined in Data.Gibberish.Types toJSON :: Frequencies -> Value # toEncoding :: Frequencies -> Encoding # toJSONList :: [Frequencies] -> Value # toEncodingList :: [Frequencies] -> Encoding # omitField :: Frequencies -> Bool # | |
Show Frequencies Source # | |
Defined in Data.Gibberish.Types showsPrec :: Int -> Frequencies -> ShowS # show :: Frequencies -> String # showList :: [Frequencies] -> ShowS # | |
NFData Frequencies Source # | |
Defined in Data.Gibberish.Types rnf :: Frequencies -> () # | |
Eq Frequencies Source # | |
Defined in Data.Gibberish.Types (==) :: Frequencies -> Frequencies -> Bool # (/=) :: Frequencies -> Frequencies -> Bool # |
Error Handling
data GibberishErr Source #
Exceptions that can occur at runtime
Instances
Exception GibberishErr Source # | |
Defined in Data.Gibberish.Errors | |
Show GibberishErr Source # | |
Defined in Data.Gibberish.Errors showsPrec :: Int -> GibberishErr -> ShowS # show :: GibberishErr -> String # showList :: [GibberishErr] -> ShowS # | |
Eq GibberishErr Source # | |
Defined in Data.Gibberish.Errors (==) :: GibberishErr -> GibberishErr -> Bool # (/=) :: GibberishErr -> GibberishErr -> Bool # |
isImpossibleError :: GibberishErr -> Bool Source #
Working with Trigraphs
genTrigraph :: [Text] -> Trigraph Source #
Generate trigraphs from a list of words