jm      NoneINParse a string as an  or a O, apply the given generic transformation to it, and re-render it back to text.'Render haskell code in a compact formatNone. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIcJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=?@ABCEFG  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHINoneGNoneGExpression with syntactic sugar' None4GDoes a name occur in a pattern?:How often does the given name occur free in an expression?(Does a name occur free in an expression?"The subset of ds that d depends onCConvert recursive lets to lambdas with tuple patterns and fix calls3Rename all variables to (locally) unqiue fresh ones^It's a pity we still need that for the pointless transformation. Otherwise a newly created idconst\... could be bound by a lambda e.g. transform' (id x -> x) ==> transform' (id -> id) ==> idMake an expression points free_Transform patterns to: fst/snd for tuple patterns head/tail for cons patterns idconstflip/. for variable paterns  NoneExpressions with holes No MLambda here because we only consider closed Terms (no alpha-renaming!). Has to be in this module, otherwise we get recursion Application/Hole/argument where another expression could go<<9 None35GN,An expression with holes to match or replaceExpression with holesNumber of holesA * rule, rewrite the first to the second s can contain s5Haskell function as a rule, applied to subexpressions&Like Up, but applied to subexpressionswApply the first rule, then try the second rule on the first result if it fails, returns the result of the first rule Use all rules3Try the first rule, if it fails use the second rule9Apply the first rule, apply the second rule to the result ;Optionally apply the rewrite rule, Opt x == Or [identity,x] =Apply the second rule only if the first rule has some results %Apply the rule only in the first pass Fill in the holes in a  %Create an array, only if the keys in lst+ are unique and all keys [0..n-1] are giveneTry to match a Rewrite to an expression, if there is a match, returns the expressions in the holesFill in the holes in a FMatch an Expr to a MExpr template, return the values used in the holesYet another pointless transformation: Bring an MExpr to (more pointless) form by seeing it as a function hole_n -> ... and writing that in pointless form%Is there a (Hole n) in an expression?7Variants of a rewrite rule: fill in (some of) the holes2haddock doesn't like n+k patterns, so rewrite them7Variants of a rewrite rule: fill in (some of) the holes2haddock doesn't like n+k patterns, so rewrite them_Use this rewrite rule and rewrite rules derived from it by iterated pointless transformation Construct a  rewrite rule Construct a  rewrite rule Construct a  rewrite rule Construct a  rewrite ruleApply Down/Up repeatedlyApply Down/Up repeatedly'     ! "#$%    "     ! "#$% None;GIN&'()*+,-./0123456789     "3&'()*+,-./0123456789 None345:The size" of an expression, lower is bettervThis seems to be a better size for our purposes, despite being "a little" slower because of the wasteful uglyprinting;Optimize an expression<Apply all rewrite rules once=Apply a single rewrite rule>.Apply a rewrite rule to an expression in a deep, position, i.e. from inside a RR,CRR or Down ?@A:;<=B>; ?@A:;<=B> SafeACDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ CDEFGHI0JKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ SafeI Safe SafeSafe               Safe !"#$%&'() !"#$%&'() !"#$%&'();Don Stewart, Lennart Kolmodin 2007, Twan van Laarhoven 2008GPL-style (see LICENSE)None*+,-./0123456789:;<=>?@ABCD*+,-./0123456789:;<=>?@ABCD8:NoneEE] is a smart constructor that inserts parens when the first argument is an infix application. FGHIJKLMNE FGHIJKLMNENoneOPQOPQNoneRcalculates "desired" indentation and return pretty-printed declarations the indentation calculations are still pretty much rough guesswork. i'll have to figure out a way to do some _reliable_ pretty-printing!STRSTRNone NUVWXYZ[\]^_`abcdefghiUVWXYZ[\]^_`abcdefghiNonej"Convert a string to pointfree form klmnojpq klmnojpqNonersturstuNone!"+&vwxyz{|}~       vwxyz{|}~     None4G,We can accumulate an interesting environmentExtract the default environmentCall the binary:NoneNoneNoneActually run the hoogle binaryNoneNice little combinator used to throw away error messages from an Either and just keep a Maybe indicating the success of the computation.-Parse an instance declaration. Sample inputs: Linstance Monad [] instance (Monoid w) => Monad (Writer w) instance (State s) Wrapper for the instance parser.nSplit the input into a list of the instances, then run each instance through the parser. Collect successes.)The standard modules we ask GHCi to load.Main processing function for @instances. Takes a class name and return a list of lines to output (which will actually only be one).Main processing function for @instances-importing. Takes the args, which are words'd. The all but the last argument are taken to be the modules to import, and the last is the typeclass whose instances we want to print.XInterface with GHCi to get the input for the parser, then send it through the parser.  NoneGNoneNone    !"#$%&'()*+,-./0123456789:;9:<=>?@<ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmklnkloklpklqklrkstksukvwklxklyklzkv{ks|kv}kv~kvkvkvkvkvkvkvkvkvkvkvkkkkskskskkkkkkkkkklklklklklklklklklklkl      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHI*JKLMNO P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m m n o p q r s t u v w x y z { | } ~                                       9            t                    H MI !"#$%&'()*+,-./01233456789::;<=>?@ABCDEFGHIJKLLMNOPQRSTUVWXYZ[\]^_`abcdeYfghijklmnopqrstuvwxyz{|}~e<Slambd_G5CHhvDozV57xOB63vxJwCLambdabot.Plugin.HaskellLambdabot.Util.Parser"Lambdabot.Plugin.Haskell.Pl.Common"Lambdabot.Plugin.Haskell.Pl.Parser)Lambdabot.Plugin.Haskell.Pl.PrettyPrinter%Lambdabot.Plugin.Haskell.Pl.Transform!Lambdabot.Plugin.Haskell.Pl.Names#Lambdabot.Plugin.Haskell.Pl.RuleLib!Lambdabot.Plugin.Haskell.Pl.Rules$Lambdabot.Plugin.Haskell.Pl.Optimize#Lambdabot.Plugin.Haskell.Free.Parse"Lambdabot.Plugin.Haskell.Free.Util"Lambdabot.Plugin.Haskell.Free.Type"Lambdabot.Plugin.Haskell.Free.Expr%Lambdabot.Plugin.Haskell.Free.Theorem)Lambdabot.Plugin.Haskell.Free.FreeTheoremLambdabot.Plugin.Haskell.UnMtlLambdabot.Plugin.Haskell.UndoLambdabot.Plugin.Haskell.SourceLambdabot.Plugin.Haskell.Pretty!Lambdabot.Plugin.Haskell.PointfulLambdabot.Plugin.Haskell.Pl Lambdabot.Plugin.Haskell.HaddockLambdabot.Config.HaskellLambdabot.Plugin.Haskell.DjinnLambdabot.Plugin.Haskell.EvalLambdabot.Plugin.Haskell.CheckLambdabot.Plugin.Haskell.Hoogle"Lambdabot.Plugin.Haskell.InstancesLambdabot.Plugin.Haskell.TypeLambdabot.Plugin.Haskell.Free unmtlPlugin undoPlugin sourcePlugin prettyPluginpointfulPluginplPlugin haddockPlugin evalPrefixestrustedPackages languageExts djinnBinary ghcBinary ghciBinary hoogleBinary muevalBinarymaxPasteLength djinnPlugin evalPlugin checkPlugin hooglePlugininstancesPlugin typePlugin freePluginhaskellPlugins withParsedhaske_4FklJxiwJoAI0XtFimUoU7Language.Haskell.Exts.SyntaxExpDeclprettyPrintInLineTopLevelTLDTLEDefinedeclNamedeclExprPatternPVarPConsPTupleExprVarLambdaAppLetFixityPrefInf mapTopLevelgetExprsizeExprcompflip'id'const'scombconsnilfix'if'makeListgetListbtshiftmaxPrecminPrec operatorsopchars reservedOpsopFMlookupOp lookupFixreadM $fOrdFixity $fEqFixitybaseGHC.Baseassertfail>>=>>fmapreturn Control.Arrowfirst||| Control.MonadguardjoinMonadFunctorfoldM***mfilter<$!>unless replicateM_ replicateMfoldM_ zipWithM_zipWithM mapAndUnzipMforever<=<>=>filterMData.TraversableforMsequencemapM&&&second+++ Data.Foldable minimumBymsum sequence_forM_mapM_ Data.OldList intersperse Data.Functorvoid Data.MaybefromJustisJustapliftM5liftM4liftM3liftM2liftMwhen=<<mplusmzero MonadPlusparse_AtBt9uDOS2NCyWnucTHV3yText.Parsec.Expr AssocRight AssocLeft AssocNoneAssoctpparensbracketssymbolmodName qualifiedatomicreserved charLiteral stringLiteraltableparseOppatternlambdavarlisttuple unaryNegation rightSectionmyParserexprdeclletbindifexprterm applicationendsIninputparsePF postprocessSExprSVarSLambdaSLetSAppSInfix LeftSection RightSectionListTupleEnum toSExprHeadtoSExprgetHead isOperator getInfName getPrefName $fEqAssoc $fShowPattern $fShowSExpr $fShowExpr$fShowTopLevel $fShowDecloccursPfreeInisFreeIn dependsOnunLet alphaRename transform transform'EnvtuplePMExprMAppHoleQuoteidEflipEconstEcompEsEfixEbindEextEreturnEconsEnilEappendEfoldrEfoldlEfstEsndEdollarEuncurryEcurryEheadEtailEcommaEfoldl1EequalsEnequalsEnotEplusEmultEzeroEoneElengthEsumEproductEconcatE concatMapEjoinEmapEfmapEfmapIE subtractEminusEliftMEliftM2EapEseqMEzipEzipWithEcrossEfirstEsecondEandEorEallEanyEacRewriteholesridRRCRRDownUpOrOrElseThenOptIfHardmyFire uniqueArraymatchfire' matchWith transformMhasHole getVariants' getVariantsrrListrrrr1rr2rr0downupExprArrRewriteC getRewrite RewriteRulenub'fire fromMExpr$fRewriteC(->)$fRewriteCMExprUnaryUABinaryBA collapseLists evalBinary evalUnaryassocRassocLassoc commutative simplifies onceRewritesrules assocLOps assocROpsassocOpscommutativeOps unaryBuiltinsbinaryBuiltins sizeExpr'optimizesteprewriterewSizecut toMonadPlusrewDeepParseSparse ParseResult ParseSuccess ParseErrorTokenQVarIdQConIdQVarSymQConSym OpenParen CloseParenComma Semicolon OpenBracket CloseBracket BackQuote OpenBrace CloseBraceOpDotDotOpColon OpColonColonOpEquals OpBackslashOpPipe OpBackArrowOpArrowOpAtOpTilde OpImpliesIdCaseIdClassIdData IdDefault IdDerivingIdDoIdElseIdForallIdIfIdImportIdInIdInfixIdInfixlIdInfixr IdInstanceIdLetIdModule IdNewtypeIdOfIdThenIdTypeIdWhereIdUscoreTokError peekTokengetToken ascSymbollexer$fMonadPlusParseS$fAlternativeParseS $fMonadParseS$fApplicativeParseS$fFunctorParseSPrettyprettyPpretty prettyParenprettyParenIndentprett_JItwetRppk1H5Uq3xbjDGCText.PrettyPrint.HughesPJModePageMode ZigZagModeLeftMode OneLineModeStylemode lineLengthribbonsPerLinestyle fullRender renderStylerenderfsepfcatcatsep<+><>$+$$$ punctuatehangnestvcathsephcat reduceDocmaybeDoubleQuotes maybeQuotes maybeBraces maybeBrackets maybeParensbraces doubleQuotesquotesrationaldoublefloatintegerintrbracelbracerbracklbrackrparenlparenequalsspacecoloncommasemiisEmptyempty zeroWidthText sizedTextptexttextcharDocPStrStrChr TextDetailsTypeTyForallTyArrTyTupleTyConsTyVarTyName precTYAPP precARROWprettyTs parseType parseType' normaliseTypereadType $fPrettyTypeExprCtxECDotECAppLECAppRECTyAppBuiltinBMapBIdBProj BMapTupleBArrEVarEBuiltinEVarOpEAppETyAppFLFNFR varInExpr leftVarOfExpr exprSubstapplySimplifierExpr unzipExprvarInCtxprecAPP$fPrettyBuiltin $fPrettyExprTheoremThForall ThImpliesThEqualThAnd precIMPLIESprecAND prettyTheorem prettyForall varInTheoremapplySimplifierTheorempeepholeSimplifyTheorempeepholeSimplifyTheorem'peepholeSimplifyExprpeepholeSimplifyExpr' foldEquality tryCurryingtheoremSimplify theoremSubst$fPrettyTheoremRNRnStgammaunique uniquelistuniquefnTyEnvMyMonMyState myVSupplymakeVar extractTypesfreeTheoremStr freeTheoreminitRnSt freshNamefreshFunctionName freshListNameinsertRnlookupRnrenamernExprnTy freeTheorem'PPTypePMonadpResultpErrorpFunlift0lift1lift2lift3lift4lift5mkPfun-->cuconforall_types mtlParser mtlParser' $fMonadPMonad$fApplicativePMonad$fFunctorPMonadappfindVarundo irrefutableinfixedpvardo'fetchhelpStrdoPretty prettyCmdunkLoc stabilize varsBoundHere foldFreeVarsfreeVarscountOcc substAvoiding renameBindsfreshNameAvoiding optimizeD optimizeRhs optimizeEuncomb' combinatorscombinatorModuleunfoldCombinators uncombOnceuncomb optimizeOncepointfulpfPlPlState firstTimeout maxTimeoutresoptimizeTopLevel optimizeIOHaddock HaddockState doHaddockstripPs EVALPREFIXESTRUSTEDPACKAGES LANGUAGEEXTS DJINNBINARY GHCBINARY GHCIBINARY HOOGLEBINARY MUEVALBINARYMAXPASTELENGTH trustedPkgs$fGCompare*EVALPREFIXES defaultExts$fGCompare*TRUSTEDPACKAGES$fGCompare*LANGUAGEEXTS$fGCompare*DJINNBINARY$fGCompare*GHCBINARY$fGCompare*GHCIBINARY$fGCompare*HOOGLEBINARY$fGCompare*MUEVALBINARY$fGCompare*MAXPASTELENGTHDjinnEnv getDjinnEnvdjinnDjinn getSavedEnv getUserEnv rejectingCmdsdjinnCmd djinnAddCmd djinnEnvCmd djinnNamesCmd djinnClrCmd djinnDelCmd djinnVerCmdgetDjinnVersiontryDjinnclean_argsisEval dropPrefixrunGHCdefine mergeModulesmoduleProblemsmungemungeEncdefineFromLPaste fetchLPaste resetL_hsfindPristine_hsfindL_hscheck postProcesshooglecutoff eitherToMaybe instanceP parseInstance getInstancesstdMdlsfetchInstancesfetchInstancesImportingfetchInstances' ModuleName ClassNameInstancerunit theCommandsignature_regex stripCommentsgoextract_signatures query_ghci