Safe Haskell | None |
---|---|
Language | Haskell2010 |
Main module exporting the relevant functions
- parseTok :: FilePath -> [(Key, RandTok)] -> [Text] -> Text -> Either (ParseError Char Dec) RandTok
- parseTokM :: [Text] -> Parser (Context RandTok)
- runFile :: [Text] -> FilePath -> IO Text
- parseFile :: [Text] -> FilePath -> FilePath -> IO (Either (ParseError Char Dec) RandTok)
- makeTree :: [Text] -> FilePath -> FilePath -> IO (Either (ParseError Char Dec) RandTok)
- run :: RandTok -> IO Text
- data RandTok
- type Context a = State [(Key, RandTok)] a
- data SemanticError
- runMadlang :: IO ()
Parsers for `.mad` files
parseTok :: FilePath -> [(Key, RandTok)] -> [Text] -> Text -> Either (ParseError Char Dec) RandTok Source #
Parse text as a token
f <- readFile "template.mad" parseTok f
| Parse text given a context
parseTokM :: [Text] -> Parser (Context RandTok) Source #
Parse text as a token + context (aka a reader monad with all the other functions)
runFile :: [Text] -> FilePath -> IO Text Source #
Generate randomized text from a file conatining a template
parseFile :: [Text] -> FilePath -> FilePath -> IO (Either (ParseError Char Dec) RandTok) Source #
Parse a template file into the RandTok
data type
makeTree :: [Text] -> FilePath -> FilePath -> IO (Either (ParseError Char Dec) RandTok) Source #
Parse a template into a RandTok suitable to be displayed as a tree
Functions and constructs for the RandTok
data type
datatype for a token returning a random string
Eq RandTok Source # | |
Show RandTok Source # | |
Monoid RandTok Source # | Make (Value "Hello") <> (List [(0.5," you"), (0.5, " me")]) (List [(0.5,"Hello you"), (0.5, "Hello me")]) |
Eq a => Eq (Context a) Source # | Compare inside the state monad using only the underlying objects |
Types associated with the parser
type Context a = State [(Key, RandTok)] a Source #
State monad providing context, i.e. function we've already called before
data SemanticError Source #
Datatype for a semantic error
Show SemanticError Source # | display a |
Exception SemanticError Source # | Derived via our show instance; |
Command-line executable
runMadlang :: IO () Source #
Main program action