{-      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~) tAn algebraic solution is a triple consisting of the node id, a description of the database columns and all subplans  0$Everything that contains a type. ?A varcontainer can contain type variables, or record variables Type functions Language for record labels  Type language Predicates relating to records 2Similaar to IsIn but now with a type for the name name K t -> t is a record (or type variable) that contains at least a field name <A qualified type is a type with some predicates ([predicates] :=> type) +A type scheme represents a quantified type ?Type environment is a mapping from identifiers to type schemes Is t a primitive type?  !"#$%0  !"#$%0   !"#$%JThe class substitutable exposes a function that applies a substitution to ' datatypes that are an instance of it. ;A substitution is a mapping from a type variable to a type FA substitution is a mapping from a record label to a new record label DA substitution is either a substitution over a type or over a label ;Evaluate the type function application to a type that doesn't contain a function  Apply a type function to a type &HThe FerryError datatype represents errors that occur during compilation '()*+,-./01234Print an error message !Just to satisfy the Error monad &'()*+,-./01234& 3210/.-,+*)(''()*+,-./01234 ;5%The compilation log is just a string 6Every stage has a stage number 7#Type synonym for a stage name type 8Compilationstep datatype. J A compilation step is a record containg a description (stageName field), + the internal mode name (stageMode field), o the actual stage computation (stageStep field) that transforms element of type a into a PhaseResult of type b ` and stage artefact generators, a list of function generating artefacts (stageArtefacts field). 9:;<=>`Artefact file, the first element represents the output file, in case of nothing output is given 6 on stdout. The second component is the file content. ?Name of an artefact file @Result of a compilation phase. I The error monad is used in case something went wrong during compilation 6 The first writer monad is used for logging purposes. R The second writer monad is used to store the artefacts generated by the compiler F And the reader monad stores the compiler configuration AGThe results of artefact generation are all collected in a reader monad N The final result is written to disk or screen when compilation has succeeded BZThe input mode determines whether the source program is given through a file or via stdin C6Argument mode, the program is given as input directly D,File mode, the program is read from a file EFGHIJKLMNOP@Pretty mode parses the given input and pretty prints the result Q0Echo mode prints the given input to the console R.The modes that are supported by the compiler. . run ferryc -h to see a list of all options STUVWXYZ:Parse mode will stop the compiler after the parsing phase [\FThe config datatype is used to store program flags given by the user  The compiler can be put in a R that determines what sort of 2 result the compilation process will result in.  The BA element is set to specify whether a file should be compiled or  input from the stdin J The debug component is set to switch on debugging mode, debugging mode R results in log information on the stdin and possibly extra compiler artifacts. ]^_`abcde+The default configuration for the compiler fMLift the result of generating an artefact into the overall phase result type gGet the compiler configuration h'Get the current log from a phaseresult i3Get the artefacts from the phaseresult jLExecute a phaseresult under a given configuration,, resulting in triple of:  1.) An error or the result  2.) The compilation log  3.) The generated artefacts kThrow an error l5Final log message when end of compilation is reached mSeperator line for logging nLog the message t o5Add the given file with contents to the phaseresult. ;56789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmno;56789:;<=9:;<=>?@ABDCCDE QPONMLKJIHGFFGHIJKLMNOPQR [ZYXWVUTSSTUVWXYZ[\]^_`abc]^_`abcdefghijklmno pmApply a compilation step to an expression of type a. The result of type b is returned in a phaseresult monad XThe artefacts that can be generated by a compilationstep are generated by this function ;Helper function to generate the phaseheader in the log pp qqq , Dot monad WWhile generating a dot file it is most convenient to do this in a monadic environment. UThe inner state monad contains a supply that is used to generate unique identifiers. SIn the inner Writer monad we store all the edges, the second writer monad contains Pall the nodes. The error monad is used to register any eventual problems, while *preserving the state of the inner monads. Colors #The shape of a dot node "A dot label comes in three forms: )a primitive label (just a string) SLabel %a horizontally list of labels HLabel /and a vertically ordered list of labels VLabel +Node properties describing shape of a node JAn edge runs from one node to one or more others identified by unique ids KA dot Node has an id (unique) and a list of properties decribing its shape A dot Id is just string LDot files are internally represented as a list of nodes and a list of edges rXClass for transforming values into either an error or a string representing a dot file. sCGenerate a new node with the given nodeproperties, returns the new ! fresh id in the Dot environment XGenerate an edge from arg1 to the nodes in arg2 and register it in the dot environment. aGiven a dot environment generate either the error that the computation in the environment yields ( or the resulting dot file as a string. ?Given a list of nodes and a list of edges generate a dot graph 7Generate the line that describes an edge in a dot file 6Generate the line that describes a node in a dot file 7Transform the properties into their dot representation .Transform a label into its dot representation #Add an edge to the dot environment "Add a node to the dot environment  Generate a fresh identifier  6Escape certain characters in a dot file ,rs  ,rss  tHType class for extracting all variables that occur in a value of type a uvConstant values wxyz{|+Identifiers are represented as strings  Print constants tuvwxyz{|  tuuv{zyxwwxyz{| }Database table key ~Database column type Database table column Function arguments k In future, that is when defunctionalisation is implemented function arguments should just be expressions. Record elements (Datatype for building untyped core ASTs Operator constructor )An identifier is represented by a string }~}~~   %Run a substitution over a typed AST  ;Run a substitution over a list of substituable structures ;Run a substitution over all types in the type environment 6Run a substitution over a typescheme, note that bound /variables are *NOT* touched by a substitution %Run a substitution over a predicate *Run a substitution over a qualified type &Run a substitution over a simple type  !" !" !" #&Wrapper for type unification function V | it makes sure all substitutions are applied before actual unification is performed $8Unification according to specification in documentation  | unify'6 is not a total function types star cannot be unified  | with anything. %&Helper functions for unifying records &5Helper function for unifyin individual record fields ',Function for helping with predicate merging ((Add a predicate to a list of predicates )*JCheck concistency of set of predicates + #$%&'()*+ #$%&'()*+,PBoxing environment, containing type environment, context and boxing environment -Expected boxing value .Box environment //An expression can be either a list or an atom. 8 a unboxed list is atom. An boxed atom becomes a list. 0123=Execute the unboxing in the presence of type environment env 4Initial box environment 5EStore identifier i with boxing value b in the boxing environment for  the given boxing computation 6@Lookup the type scheme of an identifier in the type environment 7QLookup the boxing value of an identifier in the box environment 88Run the boxing computation with expected boxing value t 98Get the boxing context value (or expected boxing value) :qRun the boxing computation without an expected boxing value ;$Convert a type into a boxing value <!Heavily simplified inst, it doesn't work as a proper inst H from the type system it only works for types that are passed to trans. =EDetermine how to transform an expression given an expected box value &and the box value of the expression. >2Wrap the given expression in a box-function call ?5Wrap the given expression in an unbox-function call @SCheck whether the expected box value (if specified) matches the inferred box value A4Deal with corner case of lazy unboxing, the result & type is a list but the boxing says it' s an atom & in that case we perform the unboxing B<Run the boxing transformation over an expression, computing 8 for every epression a new expression and its box value CDBox function parameters EvConstruct a list of all function arguments with their respective box value, and the result box value of the function. ,-./0123456789:;<=>?@ABCDE,-./2100123456789:;<=>?@ABCDEFEDatatype that contains the functions that are needed for a traversal GHIJKLMNOPQRSTUVIdentity traversel WMonadic traversal XcThis function traverses the whole CoreExpr tree and applies the given function at every node after 5 | that the function is applied to all its children. FGHIJKLMNOPQRSTUVWXFGHIJKLMNOPQRSTUGHIJKLMNOPQRSTUVWX(Class for pretty printing a value of a. Ipretty function transforms a value of a into a string with identation i. 5Shorthand for pretty without the identation argument ,A newline followed by indenting n positions :maps its first argument over the third, then intersperses K the result with the second argument, and finally concatenates everything. ZPretty print the values xs then intersperse with a comma and transform it into one string YYYZ-Transform core expression to dot environment [3Convert function parameters to dot representations \'Convert a record element to a dot node ]3Generate a string representation of a database key ^_`ab^_`ab^_`abG  !"#$%rsvwxyz{|G|v{zyxw !"#$%  rs/rstuvwxyz{|}~/|v{zyxwtu}~rsccc2de6Section introducing aliases for commonly used columns Results are stored in column: f6Section introducing aliases for commonly used columns Results are stored in column: g6Section introducing aliases for commonly used columns Results are stored in column: h6Section introducing aliases for commonly used columns Results are stored in column: i6Section introducing aliases for commonly used columns Results are stored in column: j6Section introducing aliases for commonly used columns Results are stored in column: k6Section introducing aliases for commonly used columns Results are stored in column: l6Section introducing aliases for commonly used columns Results are stored in column: m6Section introducing aliases for commonly used columns Results are stored in column: n6Section introducing aliases for commonly used columns Results are stored in column: o6Section introducing aliases for commonly used columns Results are stored in column: p6Section introducing aliases for commonly used columns Results are stored in column: qConstruct the ith item columns rConstruct the ith iter column s'Prefix for intermediate column numbers tu?Transform Ferry core into a relation algebra modelled as a DAG vPrimitive values ETransform the variable environment w-Transformation of gamma for if then else xCompile a function parameter % | Function is partial, i.e. it doesn't compile lambda'-s as arguments yCompile function application. F | Expects a core expression the function, and the evaluated argument z{bCompile a lambda where the argument variable is bound to the given expression |1Transform gamma for map function }~2defghijklmnopqrstuvwxyz{|}~2defghijklmnopqrstuvwxyz{|}~    !" #$jCount variable node, needs a specialized type in the AST and therefore still expects the type of the list EWrap an expression that is to be passed as an argument to a function +Apply equality operator to two expressions Apply negation to expression $Apply length function to expression <Create the zip variable node with specialized function type JCreate a typed let binding node  Zip two list %All variable node =Chain two boolean expression together in an and relation ?Return the type that two lists that are zipped would result in %Rewrite of list equality YGiven two list expressions returns an expression that checks that they have equal length =Given two lists of equal length compute elementwise equality &'q(kThe compiler pipeline. The given Core AST is transformed dependent on the configuration of the Phaseresult  monad. oThe compiler pipeline. Some tools might already provide a typed AST, is the same as the normal backEndPipeline  without type inferencing. )The compiler pipeline X Note that there should be a monadic style for handling all the steps in the pipeline S&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqSq&3210/.-,+*)('4\]^_`abcR[ZYXWVUTSEQPONMLKJIHGFdBDCeA@?>89:;<=765fghijklmnop*+,-./01/23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\] ^ _ ` a a b c d e f g h i j k f l m n o p q r s t u v w x y z { | } ~               m #&(()                                              !"#$%&'()*+|,-./0123456789:;<=>?@ABCDDEFGHIJKLMNOPQRSTUVWXYZWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !!!""""""""""""":##$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%%%&&)FerryCore-0.4.6.4Database.Ferry.SyntaxTypedDatabase.Ferry.CompilerDatabase.Ferry.Syntax Database.Ferry.Common.Data.Plans"Database.Ferry.TypedCore.Data.Type*Database.Ferry.TypedCore.Data.Substitution*Database.Ferry.TypedCore.Data.TypeFunction#Database.Ferry.Compiler.Error.ErrorDatabase.Ferry.Compiler.Types#Database.Ferry.Compiler.ExecuteStep0Database.Ferry.Compiler.Stages.AlgebraToXMLStage Database.Ferry.Common.Render.DotDatabase.Ferry.Common.Data.BaseDatabase.Ferry.Core.Data.Core'Database.Ferry.TypedCore.Data.TypedCore'Database.Ferry.TypedCore.Data.InstancesDatabase.Ferry.TypeSystem.Types%Database.Ferry.TypeSystem.Unification&Database.Ferry.TypedCore.Boxing.Boxing)Database.Ferry.TypedCore.Convert.Traverse#Database.Ferry.Common.Render.Pretty!Database.Ferry.Core.Render.PrettyDatabase.Ferry.Core.Render.Dot&Database.Ferry.TypedCore.Render.Pretty#Database.Ferry.TypedCore.Render.DotDatabase.Ferry.Impossible.Database.Ferry.TypedCore.Convert.CoreToAlgebra-Database.Ferry.Compiler.Stages.ToAlgebraStage+Database.Ferry.TypedCore.Convert.Specialize)Database.Ferry.TypedCore.Data.TypeClasses!Database.Ferry.TypeSystem.Prelude*Database.Ferry.Compiler.Stages.BoxingStage*Database.Ferry.TypeSystem.ContextReduction$Database.Ferry.TypeSystem.AlgorithmW-Database.Ferry.Compiler.Stages.TypeInferStage,Database.Ferry.TypedCore.Rewrite.Combinators*Database.Ferry.TypedCore.Rewrite.OpRewrite+Database.Ferry.Compiler.Stages.RewriteStageDatabase.Ferry.Compiler.Stages Database.Ferry.Compiler.Pipeline!Database.Ferry.Compiler.TransformHasTypetypeOfFTFnTr'TrRLabelRVarRGenFTypeFTFFFnFRecFVarFListFBoolFStringFFloatFIntFUnitFGenPredHasIsInQual:=>TySchemeForallintfloatstringboollistvarrecfngenT.-> FerryErrorProcessCompleteUnificationFailUnificationOfRecordFieldsFailedRecordWithoutINotARecordTypeRecordDuplicateFieldsClassNotDefinedSuperClassNotDefinedClassAlreadyDefinedErrorUnificationRecErrorUnificationError ParserError NoSuchFile handleErrorLogStageNameCompilationStep stageName stageMode stageStepstageArtefactsFileFileName PhaseResultArtefactResultInputArgArtefactTypeXMLDotAlgDotBox DotRewriteDotTypeDotCoreDotAST PrettyCorePrettyNormalAST PrettyASTEchoMode AlgebraXMLAlgebraBoxing OpRewrite TypeInfer Transform NormaliseParseReadConfigmodelogFileoutputinputartefactdebug allArtefacts defaultConfigartefactToPhaseResult getConfiggetLoggetFilesrunPhasenewError endProcesslinelogMsgaddFile executeStepxmlPhaseDotifydot VarContainervarsConstCUnitCStringCBoolCFloatCInt IdentifierKeyTUnitTBoolTStringTFloatTIntColumnParamParAbstrParExprRecElemCoreExprIfTableElemNilConsRecLetAppVarConstantBinOpOpIdentPrettypretty prettyPrintnewLinemapIntersperseConcatintersperseComma algebraPhase boxingPhasetypeInferPhase rewritePhasebackEndPipelinebackEndPipeline'typedCoreToAlgebraAlgResSubPlan emptyPlansubPlangetPlan transform planBuilder mkProperty cssToPropcsToProp colsToNodessetTypeftvfrvhasQVarRecGensTyGensTyEnvisPrim SubstitutableapplyTSubstRSubstSubstevalTy applyTyFn$fErrorFerryErrorcreateArtefacts phaseHeaderxmlStageDotColorGrayWhiteBlackYellowGreenBlueRedShapeTriangleOvalCircleRectLabelVLabelHLabelSLabelNodeProp TextColorEdgeNodeIdDotFilenodeedgerunDotdotFiledotEdgedotNodepropsDotlabelDotaddEdgeaddNode getFreshIdescapetoString$fSubstitutableCoreExpr$fSubstitutable[]$fSubstitutableMap$fSubstitutableTyScheme$fSubstitutablePred$fSubstitutableQual$fSubstitutableFTypeAlgWrunAlgWgetGammagetSubstputSubst freshTyVarlookupVariableaddToEnvaddSubstitutionupdateSubstitutionlocalAddSubstitutionlocalAddRecSubstitutionupdateRecSubstitutionaddRecSubstitutionapplyS applySubstunifyunify' unifyRecords unifyFields mergeQuals insertQual mergeQuals' consistents consistentContextBoxEnvBoxBFnListAtom runBoxingemptyEnvfromGamfromEnv withContextgetFromContext noContexttransinstboxOpboxFnunboxFn resultChecktopBoxboxboxRecboxParam varsWithBoxFoldCorebinOpF constantFvarFappFletFrecFconsFnilFelemFtableFifFpExprFpAbstrFrRecEF idFoldCore mFoldCoretraverseprettyTytoDot paramToDotrecToDot keyToString typeToDot impossibleGraphMresCol resColPrimeresColPrimePrimeordColordPrime iterPrimeiterRposPrime posPrimePrimeouterinneroldCol mkPrefixCol mkPrefixIter prefixCol recInNil2Alg coreToAlgebra transformGam algResLoop compileParam compileAppE1 makeSubPlan compileLambdaalgResvkeysmergeTableStructuremergeTableStructureFirstmergeTableStructureLastmergeTableStructureSeq listFirst listSequencerecElemToAlgebrarecElemsToAlgebra mapForward cleanInnerabsPoscoreCol2AlgColkey2Key leafNames leafNumberscolLeafscolSizeincrColsminColdecrColsgetCol colsToSchema typeToCols recsToCols algebraStagegroupNSpecializeClassEnvTransformerClassEnvInstClass<:>definedaddClass addInstancegetClass emptyClassEnvbaseEnv primitives inferStagemakeDotreduce simplifyPredsfilterImpossiblePreds typeInferalgWalgWArg uniqueKeysrecElemsToTyRecElemsrecElemToTyRecElemcolumnToTyColumncolumnToRecElem typeToFType keyToTyKey typeOfConstgencountFwrapArgeqnotFlengthFminPFzipFbindingzipCallNmapNandExprorExprzippedTyRewritegetFreshIdentifier getFreshVar runRewriterewriterewrite' appRewrite opRewrite concatMapR addBindingsopOrEqordRec recCompExprordList eqRecExpr recElemEq eqListExpreqLengthelemEqeqAbstrnotEqcompile