-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Text.Spintax.RandomPhrase module
- Loading branch information
1 parent
157fcb8
commit 31a2237
Showing
4 changed files
with
51 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Text.Spintax.RandomPhrase where | ||
|
||
import qualified Data.Text as T | ||
import Text.Spintax | ||
|
||
type RandomPhrase = T.Text | ||
|
||
-- | Generate random passphrase or unique id | ||
-- | ||
-- >λ> randomPhrase "-" [["blacky","monk","gillespie","coltrane"],["apple","apricot","banana","coconut"],["kant","hegel","husserl","habermas"]] | ||
-- > Right "coltrane-coconut-kant" | ||
-- | ||
randomPhrase :: T.Text -> [[T.Text]] -> IO (Either String RandomPhrase) | ||
randomPhrase s ls = spintax $ writeSpintaxExpression s $ writeSpintaxAlternative <$> ls | ||
|