`Z      None345689;=FT HState monad providing context, i.e. function we've already called before.datatype for a token returning a random string$Pretoken, aka token as first read in dataype for a key aka token name 0datatype for a double representing a probability!Make N a monoid so we can append them together nicely (since they do generate text). d(Value "Hello") <> (List [(0.5," you"), (0.5, " me")]) (List [(0.5,"Hello you"), (0.5, "Hello me")])"@Compare inside the state monad using only the underlying objects #$ %&'($#&('None<Datatype for a semantic error)5Throw custom error given by string, within the parser*Throw  error within parser+-Throws error when a function is defined twice,Constant to start s- Convert a Text to a . for use with a pretty-printer/*big semantics checker that sequences stuff0fTake the head of the list, or throw the appropriate error given which functions we are trying to call.19Access argument, or throw error if the list is too short.2'checker to verify there is at most one :return or  :define key statement3 Checks that we have at most one  `:return` template in the file4+Checks that there are no instances of a key5Derived via our show instance;6 display a ! nicely with coloration & whatnot  7/081 None` Draw as a syntax Tree9Function to transform a 7 into a `Tree String` so that it can be pretty-printed. tokToTree 1.0 tok None;= :Drop file Extension "Get directory associated to a file;1Function to apply a value on both arguments, e.g. between .$ (char '"')<0Normalize pre-tokens/corresponding probabilities=-Helper function for creating a cdf from a pdf>Show as a T.Text?Pretty-print a ParseError@Strip a pre-token's nameARead a file in as a Text : ;<=>?@BANone#t Generate randomized text from a  getText :: IO T.Text getText = do let exampleTok = List [(1.0,List [(0.5,Value "heads"),(0.5,Value "tails")])] run exampleTok ,Same thing, but uses a catamorphism (slower)C5Helper function to compute the cdf when we have a pdfDAAnother helper function, this time for use with our catamorphism.None+{ E(A map with all the modifiers for MadlangFJumble the words in a stringGStrip file extensionHGet the :return valueI(Convert the stuff after the number to a J5Build token in tree structure, without concatenating.K2Build the token without concatenating, yielding a # suitable to be printed as a tree.L+Given keys naming the tokens, and lists of  , build our MPSort the keys that we have parsed so that dependencies are in the correct placesN.Ordering on the keys to account for dependencyEFGHKLMNoneB O0Parse a lexeme, aka deal with whitespace nicely.P*space consumer with awareness for commentsQ6parse a symbol, i.e. string plus surrouding whitespaceRParse a number/probabilitySParse an integerT-Make sure definition blocks start un-indentedU0Make contents of definition blocks are indented.VParse between quotesWParse a keywordX Parse a varY Parse the Y keyword.Z Parse the [ keyword.\ Parse the \ keyword.] Parse the  `:return` keyword.^&Parse a template name (what follows a  `:define` or _ block)`Parse a modifieraParse template into a  of referents and stringsb*Parse a probability/corresponding templatecParse a function name for a  `:category` block.d Parse an \eParse a Y block[Parse a [ blockfParse a  `:library` declarationg Parse the  `:return` blockhParse the program in terms of  and the s to link them.QParse text as a token + context (aka a reader monad with all the other functions)iParse text as token + contextj!Parse text as a list of functionsk@Parse text as a list of tokens, suitable for printing as a tree.Parse text given a context }import qualified Data.Text.IO as TIO getParsed = do f <- TIO.readFile "template.mad" parseTok "filename.mad" [] [] f8Parse text as a token, suitable for printing as a tree..lParse inclusions!File name to use for parse errors2Context, i.e. other random data paired with a key.1list of variables to substitute into the templateActaul text to parseResultjkmnl None<M Parse a template file into the  data typeo'Generate text from file with inclusionsKCache the parsed strucutre (and libraries it depends on) as a binary file `.filename.mbc`(, reading instead from it when possible.:Generate randomized text from a file containing a templatepRun n times.qRun in the appropriate folder-Run based on text input, with nothing linked.rGet file as contextBParse a template into a RandTok suitable to be displayed as a tree)variables to substitute into the templatefolderfilepath within folderparsed 1List of variables to substitute into the templatePath to .mad file.Results None09KWwt for an EDSL, e.g. ydemoQQ :: T.Text demoQQ = run [madlang| :define something 1.0 "hello" 1.0 "goodbye" :return 1.0 something |] nNote that this is in general much faster than running interpreted code, though inclusions do not work in the t or in spliced expressions.u Convert a v] containing to a `Q Exp` with the parsed syntax tree. Embedded code can contain inclusions.w_Turn a parse error into an error that will be caught when Template Haskell compiles at runtime.Splice for embedding a '.mad' file, e.g. >demo :: IO T.Text demo = run $(madFile "twitter-bot.mad") %Embedded code can contain inclusions. NoneXAs an example, `vmchale/some-library` would be valid input.NoneY   x    ! " # $ % & ' ( ) *+,-.+/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} ~   lm &madlang-4.0.1.0-DsRTr2lHB7M7OnXoSWA0Pe Text.MadlibsText.Madlibs.Internal.TypesText.Madlibs.Cata.SemErrText.Madlibs.Cata.DisplayText.Madlibs.Internal.UtilsText.Madlibs.Cata.RunText.Madlibs.Ana.ParseUtilsText.Madlibs.Ana.ParseText.Madlibs.Ana.ResolveText.Madlibs.Generate.THText.Madlibs.Packaging.FetchContextRandTokListValueKey SemanticErrorNoReturnCircularFunctionCallsInsufficientArgsDoubleDefinition NoContextImportNotFound displayTreegetDirrunrunCata parseTokMparseTok parseTree parseFile cacheFilerunFilerunFileNrunTextmakeTreemadlangmadFile fetchGithubinstallVimPlugin fetchPackages cleanPackagesPreTokProb$fMonoidRandTok $fEqStateTNameapplyRandTokFValueFListF customErrornoReturndoubleDefinition semErrStarttext'-ansi-wl-pprint-0.6.8.2-5BM7dTiJp4zJatfPpri1Rd%Text.PrettyPrint.ANSI.Leijen.InternalDoccheckSemanticshead'accesscheckKeysingleInstance noInstance$fExceptionSemanticError$fShowSemanticErrorParser headNoReturn tokToTree dropExtension.$ normalizecdfshow'parseErrorPretty'unTok readFile' readLibFilemkCdf mkCdfCata modifierListjumblestrip takeTemplate concatTokbuildTok buildTreebuildsortKeys orderKeyslexeme spaceConsumersymbolfloatinteger nonIndented indentGuardquotekeywordvardefinecatcategoryincludemainnamebaseGHC.BasereturnmodifierpreStrpairfunction inclusions definition preLibraryfinalprogram parseTreeM parseTokF parseTreeFparseInclusionsparseTokInternalparseTokFInternalgetInclusionCtx runInFolderN runInFolderparseCtxpathSeptemplate-haskellLanguage.Haskell.TH.Quote QuasiQuotertextToExpressionStringerrorgen