Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Documentation
spintax :: Text -> IO (Either String Text) Source #
Generate random texts based on a spinning syntax template, with nested alternatives and empty options.
λ> spintax "{{Oh my God|Awesome|Can't believe that}, {a|the}|A|The} {quick {and dirty |||}||}{brown |pink |grey |black |yellow }{fox|flea|elephant|panther|bear} jumps over {the|a} {lazy |smelly |sleepy |grouchy }{dog|cat|whale}{|||, that's {really |||}amazing}{.|!|...}" Right "Awesome, the quick pink fox jumps over a sleepy whale."
Utils
writeSpintaxAlternative :: [Text] -> Text Source #
Write a spintax alternative
λ> writeSpintaxAlternative ["apple","apricot","banana","coconut"]
"{apple|apricot|banana|coconut}"