ϡ2      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                  ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; <=>? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t uvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnop q r s t u v!w!x"y"z"{"|"}"~"""""########################################################################################$$$$$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%& &     !"#$%&'''(')'*'+','-'.'/'0'1'H( Safe-InferredA&Other constructors at the spec level. ?All material regions in a data type are captured in a closure. !Region is captured in a closure. 8Allocation into all material regions in some data type. Allocation into some region. 1Write to all material regions in some data type. Write of some region. -Read of all material regions in a data type. %Read the head region in a data type. Read of some region. +The function type constructor is baked in. ,The unit data type constructor is baked in. Witness type constructors. >Non-interfering effects are disjoint. Used for rewrite rules. (Manifestness of some region (not lazy). -Laziness of the primary region in some type. Laziness of some region. Distinctness of some n regions -Mutability of material regions in some type. Mutability of some region. +Constancy of material regions in some type Constancy of some region. -Globalness of material regions in some type. Globalness of some region. Emptiness of some closure. Purity of some effect. Kind constructor. Kind of closures. Kind of effects. Kind of regions. Kind of data values. Kind of witnesses. !Function kind constructor. 6 This is only well formed when it is fully applied. "Sort constructor. #Sort of computation kinds. $Sort of witness kinds. %%Kind, type and witness constructors. FThese are grouped to make it easy to determine the universe that they  belong to. &)User defined and primitive constructors. '>(level 1) Builtin Spec constructors for types of other kinds. (@(level 1) Builtin Spec constructors for the types of witnesses. )%(level 2) Builtin Kind constructors. *%(level 3) Builtin Sort constructors. +6Wraps a variable or constructor that can be added the 2 array. .)Hash value used to insert types into the 2 array of a 0. 0&A least upper bound of several types. DWe keep type sums in this normalised format instead of joining them ) together with a binary operator (like (+)"). This makes sums easier to work N with, as a given sum type often only has a single physical representation. 2?Where we can see the outer constructor of a type, its argument ? is inserted into this array. This handles common cases like  Read, Write, Alloc effects. 3 A map for named type variables. 4$A map for anonymous type variables. 5Types that can')t be placed in the other fields go here. INVARIANT: this list doesn't contain more >s. 7&The kind of the elements in this sum. =A value type, kind, or sort. IWe use the same data type to represent all three universes, as they have ! a similar algebraic structure. >Least upper bound. ? Application. @ Abstraction. A Constructor. B Variable. C1A bound occurrence of a variable, with its type. If variable hasn'/t been annotated with its real type then this  can be tBot (an empty sum). D2Named primitive that has its type attached to it. + The types of primitives must be closed. E2Named variable that should be in the environment. F8Nameless variable that should be on the deBruijn stack. G!A variable binder with its type. H#Named variable in the environment. I)Nameless variable on the deBruijn stack. J)A variable with no uses in the body doesn't need a name. KA variable binder. O  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN   ! "$#%*)('&+-,./06177234589:;<=BA@?>CFEDGJIHKNML) Safe-Inferred 23456789:;<= 23456789:;<=* Safe-InferredO*Language feature supported by a fragment. PAllow unused named matches. Q.Allow unused named data and witness bindings. RAllow name shadowing. SCAllow non-primitive functions to be instantiated at unboxed types.  Our existing backends can')t handle this, because boxed and unboxed + objects have different representations. T;Allow data and witness vars without binding occurrences if ; they are annotated directly with their types. This lets  us work with open terms. UDebruijn binders. A Most backends will want to use real names, instead of indexed  binders. VLazy let-bindings. 0 Turning this off means the runtime system won't need to build  suspensions. WNested function bindings. = The output of the lambda-lifter should not contain these. X3Function application where the thing being applied  is not a variable. ) Most backend languages (like LLVM) don't support this. YPartially applied functions Z'Partially applied primitive operators. [+Assume all functions share data invisibly,  and don'#t generate closure terms in types. \3Assume all functions perform global side effects,  and don'"t generate effect terms in types. OPQRSTUVWXYZ[\OPQRSTUVWXYZ[\O \[ZYXWVUTSRQP Safe-InferredO  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNP=BA@?>;<:98061772345./+-,%*)('&"$#!   KNMLGJIHCFED Safe-Inferred]/Construct an empty type sum of the given kind. >6Construct an empty type sum of the given kind, but in 1 form.  This isn' t exported. ^2Construct a type sum containing a single element. _/Check whether an element is a member of a sum. 3 Returns True when the first argument is $0 or !0. 7 Returns False when the first argument is another sum. ? May return False if the first argument is miskinded but still 4 alpha-equivalent to some component of the sum. `!Insert a new element into a sum. aDelete an element from a sum. bAdd two type sums. cUnion a list of 0 s together. d9Delete all members of the second sum from the first one. eTake the kind of a sum. f8Flatten out a sum, yielding a list of individual terms. gConvert a list of types to a 0 h Yield the . of a %, or ? if there isn't one. @ Yield the . of a  TyConBuiltin, or ? if there isn't one. i,The range of hashes that can be produced by h. j Yield the % corresponding to a ., or A if there isn't one. B;If this type can be put in one of our arrays then split it # into the hash and the argument. C Inverse of B. ]>^_`abcdefgh@ijBCDEFGH]^_`abcdefghij]^bc`fge_adhij]>^_`abcdefgh@ijBCDEFGH Safe-Inferredk8Lookup the type of a bound thing from the binder stack. 4 The binder stack contains the binders of all the @s we've  entered under so far. kkkk Safe-Inferredl*Describes a data constructor, used in the z table. nName of data constructor. o4Tag of constructor (order in data type declaration) pField types of constructor. q$Name of result type of constructor. r/Describes a data type constructor, used in the z table. tName of data type constructor. u)Kinds of type parameters to constructor. v.Names of data constructors of this data type,  or ?) if it has infinitely many constructors. wFThe mode of a data type records how many data constructors there are.  This can be set to Large/ for large primitive types like Int and Float.  In this case we don'(t ever expect them all to be enumerated  as case alternatives. z"A table of data type definitions, H unpacked into type and data constructors so we can find them easily. ~&The definition of a single data type. Name of the data type. Kinds of type parameters. 7Constructors of the data type, or Nothing if there are  too many to list (like with I). )An empty table of data type definitions. 2Insert a data type definition into some DataDefs. Build a z table from a list of ~ >Yield the list of data constructor names for some data type,  or ?5 for large types with too many constructors to list. lmnopqrstuvwxyz{|}~lmnopqrstuvwxyz{|}~~z{|}wyxrstuvlmnopq lmnopqrstuvwyxz{|}~+ Safe-Inferred <Things that can go wrong when checking the kind of at type. KA witness implication where the premise or conclusion has an invalid kind. <A forall where the body does not have data or witness kind. 6A type sum that does not have effect or closure kind. 6A type sum where the components have differing kinds. DA type application where the thing being applied is not a function. =A type application where the parameter and argument kinds don' t match. .Found an unapplied kind function constructor.  Found a naked sort constructor. PThe kind annotation on the variables does not match the one in the environment. An undefined type constructor. An undefined type variable. % Safe-Inferred("Take the variable name of a bind. 0 If this is an anonymous binder then there won' t be a name. Take the type of a bind. +Replace the type of a bind with a new one. Take the binder of a bind. (Make a bind from a binder and its type. -Make lists of binds that have the same type. !Take the name of bound variable. - If this is a deBruijn index then there won' t be a name. %Check whether a bound maches a bind.  E and H# match if they have the same name.  UIx 0 _ and BAnon _ always match.  Yields J- for other combinations of bounds and binds. 3Check whether a named bound matches a named bind.  Yields J0 if they are not named or have different names.  Convert a G to a C, ready for substitution. Returns E for H, UIx 0 for I  and ? for J, because there's nothing to substitute.  Convert some Gs to Bounds Construct a deBruijn index. Construct an empty type sum. Construct a type application. Construct a type application. +Construct a sequence of type applications. CFlatten a sequence ot type applications into the function part and  arguments, if any. HFlatten a sequence of type applications, returning the type constructor # and arguments, if there is one. HFlatten a sequence of type applications, returning the type constructor L and arguments, if there is one. Only accept primitive type constructors. HFlatten a sequence of type applications, returning the type constructor G and arguments, if there is one. Only accept data type constructors. /Take the prime region variable of a data type. O This corresponds to the region the outermost constructor is allocated into. >Build an anonymous type abstraction, with a single parameter. >Build an anonymous type abstraction, with several parameters. 0Split nested foralls from the front of a type,  or ? if there was no outer forall.  Erase all @ quantifiers from a type. Construct a kind function. Construct some kind functions. Destruct a kind function 6Destruct a chain of kind functions into the arguments Like 9, but return argument and return kinds in the same list. ATake the result kind of a kind function, or return the same kind  unharmed if it's not a kind function. "Construct a value type function, ) with the provided effect and closure. 'Destruct the type of a value function. !Destruct the type of a function, 1 returning just the argument and result types. !Destruct the type of a function, D returning the witness argument, value argument and result types. @ The function type must have the witness implications before  the value arguments, eg T1 => T2 -> T3 -> T4 -> T5. =Determine the arity of an expression by looking at its type. / Count all the function arrows, and foralls. 0Construct a pure and empty value type function. &Construct a witness implication type. 4Build a nullary type constructor of the given kind. 6Build a type constructor application of one argumnet. IKLMFFIKLM Safe-Inferred Data constructors. Name of the data constructor. Type of the data constructor.  The type must be closed. CAlgebraic constructors can be deconstructed with case-expressions, * and must have a data type declaration. Non-algebraic types like N can't be inspected with  case-expressions. Data constructor names. -Data constructor name defined by the client. &The unit data constructor is builtin. #Take the name of data constructor. 0Take the type annotation of a data constructor. The unit data constructor. $Make an algebraic data constructor. *Make a non-algebraic (solid) constructor. : These are used for location values in the interpreter, 9 and for floating point literals in the main compiler. OP OP, Safe-Inferred+Built-in witness constructors. CThese are used to convert a runtime capability into a witness that ' the corresponding property is true. BConvert a capability guaranteeing the constancy of a region, into 7 a witness that allocation into that region is pure. : This lets us increase the sharing of constant objects,  because we can'1t tell constant objects of the same value apart. alloc :: [r : %]. Const r => Pure (Alloc r)BConvert a capability guaranteeing the constancy of a region, into 3 a witness that a read from that region is pure. A This lets us suspend applications that read constant objects,  because it doesn'#t matter if the read is delayed, we' ll always  get the same result. read :: [r : %]. Const r => Pure (Read r)AConvert a capability guaranteeing that a region is in the global C heap, into a witness that a closure using this region is empty. A This lets us rely on the garbage collector to reclaim objects B in the region. It is needed when we suspend the evaluation of @ expressions that have a region in their closure, because the @ type of the returned thunk may not reveal that it references  objects in that region. use :: [r : %]. Global r => Empty (Use r)$(axiom) The empty closure is empty. empty :: Empty $0!(axiom) The pure effect is pure. pure :: Pure !0Witness constructors. 1Witness constructors defined in the environment. @ In the interpreter we use this to hold runtime capabilities. % The attached type must be closed. .Witness constructors baked into the language. :When a witness exists in the program it guarantees that a , certain property of the program is true. 3Type can appear as the argument of an application. Joining of witnesses. Witness application. Witness constructor. Witness variable.  Pattern matching.  1Match a data constructor and bind its arguments.  %The default pattern always succeeds.  Case alternatives. 1Describes how a let binding should be evaluated. Use lazy evaluation. B The witness shows that the head region of the bound expression H can contain thunks (is lazy), or Nothing if there is no head region. 1Evaluate binding before substituting the result. Possibly recursive bindings. )Holds a region handle during evaluation. Bind a local region variable, $ and witnesses to its properties. *Recursive binding of lambda abstractions. "Non-recursive expression binding.  Type casts. 5Forget about the closure (sharing) of an expression. -Purify the effect (action) of an expression. %Weaken the closure of an expression. > The closures of these expressions are added to the closure  of the body. $Weaken the effect of an expression. + The given effect is added to the effect  of the body. Well-typed expressions produce Data values when evaluated, # and their types aways have kind Q (Data) 6Witness can appear as the argument of an application. 3Type can appear as the argument of an application.  Type cast. Case branching.  Possibly recursive bindings. ! Application. ")Value and Witness abstraction (level-0). #Type abstraction (level-1). $Data constructor or literal. %)Value variable or primitive operation. ,      !"#$%,      !"#$%       %$#"! - Safe-Inferred RSTUVWXYZ RSTUVWXYZ  Safe-Inferred)Check whether a type is a B *#Test if some type is an empty TSum +Check whether a type is a B, A or is Bottom. ,%Check if some kind is the data kind. -'Check if some kind is the region kind. .'Check if some kind is the effect kind. /(Check if some kind is the closure kind. 0(Check if some kind is the witness kind. 13Check whether this type is that of algebraic data. =It needs to have an explicit data constructor out the front, E and not a type variable. The constructor must not be the function 0 constructor, and must return a value of kind Q. 2,Check whether type is a witness constructor 3$Check whether this is the type of a Const witness. 4$Check whether this is the type of a Mutable witness. 5$Check whether this is the type of a Distinct witness. 6-Check whether this is an atomic read effect. 7.Check whether this is an atomic write effect. 8.Check whether this is an atomic alloc effect. 95Check whether an effect is some sort of read effect.  Matches Read HeadRead and DeepRead. :;Check whether an effect is some sort of allocation effect.  Matches Alloc and  DeepAlloc ;;Check whether an effect is some sort of allocation effect.  Matches Alloc and  DeepAlloc &'()*+,-./0123456789:;&'()*+,-./0123456789:;&'()*+,-./0123456789:;&'()*+,-./0123456789:;.None[2Pretty print a binder, adding spaces after names. ! The RAnon and None binders don't need spaces, as they're single symbols. \-Print a group of binders with the same type. ][\^_`abcdefgYhijklmnopqrstuvwxyz{|}~ ][\^_`abcdefg/ Safe-InferredTake the kind of a %, if there is one. <2Take the superkind of an atomic kind constructor. Yields ?' for the kind function (~>) as it doesn't have a sort  without being fully applied. =-Take the kind of a witness type constructor. >1Take the kind of a computation type constructor. <=><=><=>0None  Safe-Inferred?"Stack of anonymous binders that we''ve entered under during substitution. A:Holds anonymous binders that were already in the program, H as well as named binders that are being rewritten to anonymous ones. D In the resulting expression all these binders will be anonymous. BKHolds all binders, independent of whether they are being rewritten or not. C Number of I in A. D Number of H in A. ESubstitution state. K Keeps track of the binders in the environment that have been rewrittten 7 to avoid variable capture or spec binder shadowing. GBound variable that we're substituting for. HWe'6ve decended past a binder that shadows the one that we're  substituting for. We')re no longer substituting, but still may * need to anonymise variables in types. 3 This can only happen for level-0 named binders. I:Level-1 names that need to be rewritten to avoid capture. J:Level-0 names that need to be rewritten to avoid capture. K#Rewriting stack for level-1 names. L#Rewriting stack for level-0 names. NDRewrite names in some thing to anonymous form if they conflict with  any names in the E. state. We use this to avoid variable capture  during substitution. O(Push several binds onto the bind stack, : anonymyzing them if need be to avoid variable capture. P Push a bind onto a bind stack, 8 anonymizing it if need be to avoid variable capture. Q Compare a C against the one we're substituting for. R,Push a level-1 binder on the rewrite stack. S0Push some level-1 binders on the rewrite stack. T,Push a level-0 binder on the rewrite stack. U0Push some level-0 binders on the rewrite stack. V0Rewrite the use of a level-1 binder if need be. W0Rewrite the use of a level-0 binder if need be. ?@ABCDEFGHIJKLMNOP!Names that need to be rewritten. Current bind stack. Bind to push. (New stack and possibly anonymised bind. Q(Current Bind stack during substitution. Bound we're substituting for. Bound we're looking at now. RSTUVW?@ABCDEFGHIJKLMNOPQRSTUVWMNEFGHIJKL?@ABCDPOQRSTUVW?@ABCDEFGHIJKLMNOPQRSTUVW  Safe-InferredY8Apply a function to all bound variables in the program. 5 The function is passed the current binding depth.  This is used to defined both [ and ]. Z=Lift debruijn indices less than or equal to the given depth. [ Wrapper for  liftAtDepthX that starts at depth 0. \>Lower debruijn indices less than or equal to the given depth. ] Wrapper for  lowerAtDepthX that starts at depth 0. XY$Function to apply to the bound occ. + It is passed the current binding depth. Current binding depth. 'Lift expression indices in this thing. ZNumber of levels to lift. Current binding depth. 'Lift expression indices in this thing. [\Number of levels to lower. Current binding depth. (Lower expression indices in this thing. ]XYZ[\][Z]\XY XYZ[\]  Safe-Inferred^%Type synonym to improve readability. _%Type synonym to improve readability. `A type environment. bTypes of named binders. c%Types of anonymous deBruijn binders. dThe length of the above stack. e$Types of baked in, primitive names. fAn empty environment. g*Extend an environment with a new binding. D Replaces bindings with the same name already in the environment. h3Extend an environment with a list of new bindings. D Replaces bindings with the same name already in the environment. i;Set the function that knows the types of primitive things. j.Check if the type of a name is defined by the e. kConvert a list of Gs to an environment. l2Convert a map of names to types to a environment. mCombine two environments. ; If both environments have a binding with the same name, < then the one in the second environment takes preference. n=Check whether a bound variable is present in an environment. oACheck whether a binder is already present in the an environment. Q This can only return True for named binders, not anonymous or primitive ones. p-Lookup a bound variable from an environment. q)Lookup a bound name from an environment. r-Yield the total depth of the deBruijn stack. sPLift all free deBruijn indices in the environment by the given number of steps. tGWrap locally bound (non primitive) variables defined in an environment ! around a type as new foralls. ^_`abcdefghijklmnopqrst^_`abcdefghijklmnopqrst`abcde_^fghmklrnopqijts^_`abcdefghijklmnopqrst Safe-InferredvRewrite E bounds to D bounds and attach their types. J Primitives have their types attached because they are so common in the / language, their types are closed, and we don't want to keep having to & look them up from the environment. uvuvuvuv Safe-Inferred yWhat level this binder is at. }$Describes how a variable was bound. CA description of the binding structure of some type or expression. Use of a constructor. Use of a variable.  An abstract binding expression. 6Collect the free Spec variables in a thing (level-1). -Collect all the bound variables in a thing, 0 independent of whether they are free or not. 1Collect all the spec and exp binders in a thing. /Check if a boundlevel is expression or witness Get the y corresponding to a }. Helper for constructing the  for a type binder. wxyz{|}~wxyz{|}~}~wxy|{zwxy|{z}~1 Safe-Inferred .A flattened set of features, for easy lookup. :The fragment profile describes the language features and 2 primitive operators available in the language. The name of this profile. Permitted language features. "Primitive data type declarations. Kinds of primitive types. Types of primitive operators. )Check whether a type is an unboxed type. / Some fragments limit how these can be used. <A language profile with no features or primitive operators. -This provides a simple first-order language. ,An emtpy feature set, with all flags set to J. Set a language Flag in the . NoneThe type checker monad. GCheck a type in the given environment, returning an error or its kind. FCheck a type in an empty environment, returning an error or its kind. "Check a type, returning its kind. %<=>+<=> Safe-Inferred/Trim compound closures into their components.  This is like  crushEffect', but for closures instead of effects. For example, trimming ,DeepUse (Int r2 -(Read r1 | Use r1)> Int r2) yields  just Use r1.  Only r1H might contain an actual store object that is reachable from a function  closure with such a type. AThis function assumes the closure is well-kinded, and may return ? if  this is not the case. &Trim a closure down to a closure sum.  May return ? if the closure is mis-kinded. CTrim the argument of a DeepUsed constructor down to a closure sum. ! The argument is of data kind. ?Make the appropriate Use term for a type of the given kind, or ? if  there isn'1t one. Also recursively trim types of data kind.  Safe-Inferred*Crush compound effects and closure terms. M We check for a crushable term before calling crushT because that function + will recursively crush the components. ) As equivT is already recursive, we don'#t want a doubly-recursive function E that tries to re-crush the same non-crushable type over and over. 3Crush compound effect terms into their components.  This is like & but for effects instead of closures. For example, crushing DeepRead (List r1 (Int r2)) yields (Read r1 + Read r2). 6If this type has first order kind then wrap with the  appropriate read effect. 6If this type has first order kind then wrap with the  appropriate read effect. 6If this type has first order kind then wrap with the  appropriate read effect. 6If this type has first order kind then wrap with the  appropriate read effect.  Safe-InferredCheck equivalence of types. HChecks equivalence up to alpha-renaming, as well as crushing of effects  and trimming of closures.  Return J if we find any free variables. F We assume the types are well-kinded, so that the type annotations on M bound variables match the binders. If this is not the case then you get  an indeterminate result. Like . but take the initial stacks of type binders. >If we have a UName and UPrim with the same name then these won't match I even though they pretty print the same. This will only happen due to H a compiler bugs, but is very confusing when it does, so we check for  this case explicitly. -Unpack single element sums into plain types.  Safe-Inferred2Check whether the first type subsumes the second. >Both arguments are converted to sums, and we check that every G element of the second sum is equivalent to an element in the first. BThis only works for well formed types of effect and closure kind.  Other types will yield J. None )Universes of the Disciple Core language. ((level 0). The universe of data values. B These are physical data objects that take up space at runtime.  This is like the Set* universe in constructive logic, but the 2 expressions may diverge or cause side effects. &(level 0). The universe of witnesses. B The existence of a witness in the program guarantees that some E property about how it operates at runtime. For example, a witness F of constancy of some region guarantees objects in that region will $ not be updated. This is like the Prop universe in constructive  logic. +(level 1). The universe of specifications. ; Specifications classify both witnesses and data values.  In the vanilla Haskell world "specifications" are known as  "types"6, but here we use the former term because we overload  the word "type"& to refer to kinds and sorts as well. "(level 2). The universe of kinds. " Kinds classify specifications. "(level 3). The universe of sorts.  Sorts classify kinds. HGiven the type of the type of the type of some thing (up three levels), 0 yield the universe of the original thing, or ? it was badly formed. :Given the type of the type of some thing (up two levels), 0 yield the universe of the original thing, or ? if it was badly formed. -Given the type of some thing (up one level), 0 yield the universe of the original thing, or ? if it was badly formed. !Yield the universe of some type. / universeOfType (tBot kEffect) = UniverseSpec / universeOfType kRegion = UniverseKind    2 Safe-InferredBCollect the free type variables and constructors used in a thing.  Safe-Inferred#Substitute a type into some thing. O In the target, if we find a named binder that would capture a free variable M in the type to substitute, then we rewrite that binder to anonymous form,  avoiding the capture.  Substitute a = for the C corresponding to some G in a thing.  Wrapper for  to substitute multiple things.  Substitute a = for C in some thing. Bound variable that we're subsituting into. Type to substitute. 3Names of free varaibles in the type to substitute.  Bind stack. ?@ABCDOPQ?@ABCDPOQNone%Instantiate a type with an argument. ? The type to be instantiated must have an outer forall, else ?. +Instantiate a type with several arguments. I The type to be instantiated must have at least as many outer foralls $ as provided type arguments, else ?. Type to instantiate. Argument type. Type to instantiate. Argument types. 3None GA closure-term tagged with the bound variable that the term is due to. Term due to a region handle. $Term due to a free region variable. #Term due to a free value variable. NConvert a tagged clousure to a regular closure by dropping the tag variables. FConvert a set of tagged closures to a regular closure by dropping the  tag variables. .Yield the tagged closure of a value variable. -Yield the tagged closure of a type argument,  or ? for out-of-scope type vars. "Convert the closure provided as a weakclo to tagged form.  Only terms of form `Use r` can be converted. +Mask a closure term from a tagged closure. This is used for the forget cast. ACut the terms due to the outermost binder from a tagged closure. Like ' but cut terms due to several binders. ACut the terms due to the outermost binder from a tagged closure.    Safe-Inferred  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN      !"#$%4%$#"!      4 Safe-InferredNumber of levels to lift. Current binding depth.  Lift exp indices in this thing. *Lifted, and how much to increase depth by XYZ[[ZXY Safe-Inferred8Apply a function to all bound variables in the program. 5 The function is passed the current binding depth.  This is used to defined both  and . =Lift debruijn indices less than or equal to the given depth.  Wrapper for  that starts at depth 0. >Lower debruijn indices less than or equal to the given depth.  Wrapper for  that starts at depth 0. $Function to apply to the bound occ. + It is passed the current binding depth. Current binding depth. 'Lift expression indices in this thing. Number of levels to lift. Current binding depth. 'Lift expression indices in this thing. Number of levels to lower. Current binding depth. (Lower expression indices in this thing. Number of levels to lift. Current binding depth.  Lift exp indices in this thing. *Lifted, and how much to increase depth by     Safe-InferredA fully qualified name, 0 including the name of the module it is from. A hierarchical module name.  Map of module names to modules. 7A module can be mutually recursive with other modules. Name of this module. Kinds of exported types. Types of exported values. Kinds of imported types, 4 along with the name of the module they are from. Types of imported values, 4 along with the name of the module they are from. .The module body consists of some let-bindings % wrapping a unit data constructor. We'%re only interested in the bindings, + with the unit being just a place-holder. Check if this is the Main module. 0Get the top-level kind environment of a module,  from its imported types. 0Get the top-level type environment of a module,  from its imported values. IAdd the kind environment exported by all these modules to the given one. IAdd the type environment exported by all these modules to the given one. &Check whether this is the name of the "Main" module.        Safe-Inferred>Apply the given function to every annotation in a core thing.   5 Safe-Inferred?@ABCDEFGHIJKLMNOPQRSTUVWMNEFGHIJKL?@ABCDPOQRSTUVW Safe-Inferred2Take the outermost annotation from an expression,  or Nothing if this is an  or  without an annotation. Make some nested type lambdas. +Make some nested value or witness lambdas. 4Split type lambdas from the front of an expression,  or ? if there aren't any. GSplit nested value or witness lambdas from the front of an expression,  or ? if there aren't any. &Make some nested lambda abstractions, 4 using a flag to indicate whether the lambda is a . level-1 (True), or level-0 (False) binder. 7Split nested lambdas from the front of an expression, D with a flag indicating whether the lambda was a level-1 (True),  or level-0 (False) binder. &Build sequence of value applications.  Build sequence of applications.  Similar to ) but also takes list of annotations for  the ! constructors. AFlatten an application into the function part and its arguments. Returns ?# if there is no outer application. AFlatten an application into the function part and its arguments.  This is like 7 above, except we know there is at least one argument. FFlatten an application into the function parts and arguments, if any. #Destruct sequence of applications.  Similar to ' but also keeps annotations for later. 5Flatten an application of a primop into the variable  and its arguments. Returns ? if the expression isn't a primop application. BFlatten an application of a data constructor into the constructor  and its arguments. Returns ? if the expression isn't a constructor application. -Wrap some let-bindings around an expression. <Split let-bindings from the front of an expression, if any. Take the binds of a . 9The level-1 and level-0 binders are returned separately. Like + but only take the spec (level-1) binders. Like 8 but only take the value and witness (level-0) binders. >Take the constructor name of an alternative, if there is one. Take the binds of a  .  Construct a witness application -Construct a sequence of witness applications Take the witness from an  argument, if any. FFlatten an application into the function parts and arguments, if any. AFlatten an application of a witness into the witness constructor  name and its arguments. EReturns nothing if there is no witness constructor in head position. Take the type from an  argument, if any.  Construct a value of unit type. p Safe-InferredDSpread type annotations from binders and the environment into bound . occurrences of variables and constructors.  Also convert Cs to D# form if the environment says that  they are primitive.  6None4BAll the things that can go wrong when type checking an expression  or witness. Found a naked  that wasn'"t the argument of an application. Found a naked  that wasn'"t the argument of an application. BA weakeff-cast where the type provided does not have effect kind. EA case-expression where the result types of the alternatives are not  identical. DA case-expression where the annotation on a pattern variable binder 5 does not match the field type of the constructor. AA case-expression where the type of the scrutinee does not match  the type of the pattern. DA case-expression where the pattern types could not be instantiated - with the arguments of the scrutinee type.  BA case-expression where one of the patterns has too many binders. 1A case-expression with overlapping alternatives. ,A case-expression where the alternatives don't cover all the F possible constructors, and the type has too many data constructors  to list. ,A case-expression where the alternatives don't cover all the  possible data constructors. (A case-expression with no alternatives. =A case-expression where the scrutinee type is not in our set  of data type declarations. =A case-expression where the scrutinee type is not algebraic. FA witness provided for a forget cast that does not witness emptiness. CA witness provided for a purify cast that does not witness purity. An invalid witness join. ;Tried to perform a witness application with a non-witness. =A witness application where the argument type does not match  the parameter type.  DA letregion-expression where some of the the bound region variables % are free in the type of the body. !DA withregion-expression where the handle does not have region kind. "AA letregion-expression where the witness binding references some > free region variable that is not the one being introduced. #?A letregion-expression where a bound witnesses was not for the ) the region variable being introduced. &CA letregion-expression that tried to create conflicting witnesses. )?A letregion-expression that tried to create a witness with an  invalid type. *DA letregion-expression where some of the the bound region variables % are free in the type of the body. +DA letregion-expression that tried to shadow some pre-existing named  region variables. ,DA letregion-expression where the some of the bound variables do not  have region kind. /:A recursive let-expression that has more than one binding  with the same name. 0AA recursive let-expression where the right of the binding is not  a lambda abstraction. 29A lazy let binding where the witness has the wrong type. 6GA lazy let binding without a witness that binding is in a lazy region. 7-A lazy let binding with a non-empty closure. 93A lazy let binding that has a visible side effect. :9A let-expression where the body does not have data kind. ;IA let-expression where the right of the binding does not have data kind. <GA let-expression where the type of the binder does not match the right  of the binding. =7An abstraction where the body does not have data kind. >>A value function where the parameter does not have data kind. @HA type or witness abstraction where the body has a visible side effect. C@A type abstraction that tries to shadow a type variable that is  already in the environment. E1Tried to apply something that is not a function. G;A function application where the parameter and argument don' t match. JA data constructor that wasn'"t in the set of data definitions. KFA bound occurrence of a variable whose type annotation does not match 4 the corresponding annotation in the environment. NAn undefined type variable. QFound a malformed expression,  and we don'"t have a more specific diagnosis. R>Type signature of exported binding does not match the type at  the definition site. UExported value is undefined. WFound a malformed type,  and we don'"t have a more specific diagnosis. Z)Found a kind error when checking a type. _      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[_      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ZWURQNKJGEC@>=<;:97620/,+*)&#"!  [XYVVSTXOPOLMXXHIXFIXDXABXY?XDY?XDYXD?XY?XDBXD8XDYXD345X1XDX-.X-X-YXDX'(X$%X%XO?XOYHIFIXYXYXXXXXXX   X XXLXXB?XX7 Safe-Inferred\BCollect the free Data and Witness variables in a thing (level-0).  Helper for constructing the & for an expression or witness binder. \! "#$%&'\ \! "#$%&'8 Safe-Inferreda*Type constructors used in the expression. bDType constructors used in the argument of a value-type application. c&Free spec variables in an expression. dDType constructors used in the argument of a value-type application. e)Free witness variables in an expression.  (from the Witness universe) f'Free value variables in an expression.  (from the Data universe) ]^_`abcdef()*+,-./0 ]^_`abcdef ]^_`abcdef()*+,-./0 Safe-Inferred\]^_`abcdef\_`abcdef]^ Safe-Inferredi Substitute a = for the C corresponding to some G in a thing. j Wrapper for  to substitute multiple types. k Substitute a = for a C in some thing. ghijk1234567ghijkghijk ghijk1234567 Safe-Inferredn Wrapper for m. that determines the set of free names in the B type being substituted, and starts with an empty binder stack. o Wrapper for m to substitute multiple things. 8/Rewrite or substitute into a witness variable. lmno89:;<=lmnolmno lmno89:;<=  Safe-Inferredr Wrapper for substituteWithX. that determines the set of free names in the H expression being substituted, and starts with an empty binder stack. s Wrapper for  substituteX% to substitute multiple expressions. t>Substitute the argument of an application into an expression. $ Perform type substitution for an  $ and witness substitution for an  u Wrapper for u# to substitute multiple arguments. >3Rewrite or substitute into an expression variable. pqrstu>?@Apqrstupqrstu pqrstu>?@A! Safe-Inferredv)Trim the expressions of a weaken closure (XCast CastWeakenClosure) ! into only the free variables.  For example,  trimClosures [build (k z. something k), else]  = [build, something, else]   wTrim an expression if it is a weakclo cast. ANon-recursive version. If you want to recursively trim closures,  use  transformUpX' (const trimX). BDCollect all the free variables, but return them all as expressions:  eg    freeExp  (let i = 5 [R0#] () in  updateInt [:R0 R1:]  w i ...)  will return something like  [ XType (TCon R0#)  , XVar updateInt  , XType (TCon R0#)  , XType (TCon R1#)  , XWitness w ]   vwBCvwwvvwBC" Safe-Inferred x+Check whether an expression is a variable. y.Check whether an expression is a constructor. z!Check whether an expression is a % or an $, ! or some type or witness atom. {Check whether a witness is a  or . |=Check whether an expression is a spec abstraction (level-1). }ICheck whether an expression is a value or witness abstraction (level-0). ~FCheck whether an expression is a spec, value, or witness abstraction. "Check whether an expression is an !. "Check whether an expression is an  "Check whether an expression is an  "Check whether an alternative is a  . xyz{|}~!&'()*+,-./0123456789:;xyz{|}~ xyz{|}~ xyz{|}~9NoneDPretty print a binder, ) showing its type annotation only if it's not bottom. E-Print a group of binders with the same type. FWrap a % in parens if the predicate is true. DGEHIJFKLMNOPQRSTUVYhijklmnopqrstuvwxyz{|}~DGEHIJFKLMNOPQRSTUV#None"A token with a user-defined name. HAtomic tokens are keywords, punctuation and baked-in constructor names.  They don'9t contain user-defined names or primops specific to the  language fragment. 5Meta tokens contain out-of-band information that is % eliminated before parsing proper. This is injected by  applyOffside when it finds an explit close = brace in a position where it would close a synthetic one. This is injected by dropCommentBlock when it finds " an unterminated block comment. -Tokens accepted by the core language parser. 9A named token that is specific to the language fragment  (maybe it'%s a primop), or a user defined name. 6Atomic tokens are keywords, punctuation and baked-in  constructor names. ?Meta tokens contain out-of-band information that is eliminated  before parsing proper. Some junk symbol that isn't part of the language. WThe family of a token. 8 This is used to help generate parser error messages,  so we can say ''the constructor Cons''  and ''the keyword case'' etc. X4Describe a token family, for parser error messages. 'Apply a function to all the names in a . ,Describe a token for parser error messages. .Describe a TokMeta, for lexer error messages.  Describe a , for parser error messages.  Describe a , for parser error messages. Y'Apply a function to all the names in a . aWZ[\]^X_YXX BW^]\[ZX_Y:None `LHolds a real token or start symbol which is used to apply the offside rule. aSignal that we'$re starting a block in this column. b-Apply the offside rule to this token stream. A It should have been processed with addStarts first to add the  LexemeStartLine/LexemeStartLine tokens. c0Add block and line start tokens to this stream. 9 This is lifted straight from the Haskell98 report. d1Drop newline tokens at the front fo this stream. e1Drop newline tokens at the front fo this stream. f;Check if a token is one that starts a block of statements. g)Test whether this wrapper token matches. h)Test whether this wrapper token matches. iDWhen generating new source tokens, take the position from the first " non-newline token in this list jThis is injected by b when it finds an explit close = brace in a position where it would close a synthetic one. k`almbcndefghiopjq`almbck`mlabcndefghiopjq;Noner9Drop all the comments and newline tokens in this stream. s)Drop block comments form a token stream. t$Drop newline tokens from this list. rs,Position of outer-most block comment start. turtrstu<None "A parser of core language tokens. vParse a builtin named  w4Parse a module name. x0Parse a qualified variable or constructor name. &Parse a constructor or variable name. Parse a constructor name. Parse a literal Parse a variable. Parse a deBruijn index Parse an atomic token. -Parse an atomic token and return some value. vwx vwx vwx=None Parse a type. Parse a binder. yParse a quantified type. zParse a function type. Parse a type application. 5Parse a variable, constructor or parenthesised type. {Parse a builtin  |Parse a builtin   } Parse a user  ~yz{|} ~yz{|}>NoneParse a witness expression. Parse a witness join. Parse a witness application. Parse a witness argument. 8Parse a variable, constructor or parenthesised witness. ?None_      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[@None)Language fragment compliance violations. Found a naked witness that isn't used as a function argument. Found a naked type that isn't used as a function argument. %Found a bound variable with no uses,  but the profile doesn't permit this. DFound a variable binder that shadows another one at a higher scope,  but the profile doesn't permit this. Found an unbound variable. 'Found an undefined primitive operator. 'Found an unsupported language feature. ANone Compliance checking monad. ?Class of things we can check language fragment compliance for. FCheck whether a core thing complies with a language fragment profile. Like & but with some starting environments. 3Check for compliance violations at a binding site. 3Check for compliance violations at a binding site. . The binders must all be at the same level. +Check the function part of an application. @The top level context, used at the top-level scope of a module. Record that we'%ve entered into an abstraction body. ERecord that the expression is being directly applied to an argument. )Reset the argument counter of a context. Throw an error in the monad. $Take the result from a check monad. &Fragment profile giving the supported . language features and primitive operators. Starting Kind environment. Starting Type environment. &Fragment profile giving the supported . language features and primitive operators. The thing to check. &Fragment profile giving the supported . language features and primitive operators. Starting kind environment. Starting type environment. The thing to check. The current language profile. The current environment The binder at this site. Names used under the binder. Names used above the binder. BNone'Specification of a function parameter. C We can determine the contribution to the type of the function, 5 as well as its expression based on the parameter. DBuild the type of a function from specifications of its parameters,  and the type of the body. JBuild the expression of a function from specifications of its parameters, $ and the expression for the body. !Parse a parameter specification. BIND1 BIND2 .. BINDN : TYPE  or (BIND : TYPE) * or (BIND : TYPE) { EFFECT | CLOSURE } Spec of parameters. Type of body. Type of whole function. Spec of parameters. Body of function. Expression of whole function. CNone"Parse a core language expression. ;Parse a variable, constructor or parenthesised expression. A binding for let expression. Parse a let mode specifier. > Only allow the lazy specifier with non-recursive bindings.  We don'9t support value recursion, so the right of all recursive A bindings must be explicit lambda abstractions anyway, so there's  no point suspending them. 2Letrec bindings must have a full type signature, F or use function syntax with a return type so that we can make one. Parse a single statement. Parse some statements. )Make an expression from some statements. DNoneParse a core module. Parse a type signature. 2Parse the type signature of an imported variable. 2Parse the type signature of an imported variable. $None%None'Textual keywords in the core language.  Read a named  . Read a builtin  with a non-symbolic name,  ie not '->'. Read a . String is a variable name $Charater can start a variable name. *Character can be part of a variable body. %Read a named, user defined variable. String is a constructor name. (Character can start a constructor name. ,Charater can be part of a constructor body. Read a named, user defined . !String is the name of a literal. Character can start a literal. )Character can be part of a literal body. &None)Lex a module and apply the offside rule. AAutomatically drop comments from the token stream along the way.  Lex a string into tokens. AAutomatically drop comments from the token stream along the way. )Path to source file, for error messages. Starting line number.  String containing program text.  )Path to source file, for error messages. Starting line number.  String containing program text. i   None =Carries all the information we need to work on a particular + fragment of the Disciple Core language.  $Language profile for this fragment.  =File extension to use when dumping modules in this fragment.  Read a name. Lex module source into tokens, 4 given the source name and starting line number. #Lex expression source into tokens, 3 given the source name and starting line number. 7Perform language fragment specific checks on a module. <Perform language fragment specific checks on an expression.     ;OPQRSTUVWXYZ[\    ;    O\[ZYXWVUTSRQP    ENone +Static configuration for the type checker.  These fields don'%t change as we decend into the tree. EThe starting configuration should be converted from the profile that 4 defines the language fragment you are checking.  See DDC.Core.Fragment and use  below. Data type definitions. Kinds of primitive types. Types of primitive operators. #Suppress all closure information, 3 annotating all functions with an empty closure. <This is used when checking the Disciple Core Salt fragment, % as transforms in this language don't use the closure  information. Type checker monad.  Used to manage type errors. ;Convert a langage profile to a type checker configuration. Check a witness. If it'Cs good, you get a new version with types attached to all the bound : variables, as well as the type of the overall witness. If it'+s bad, you get a description of the error. IThe returned expression has types attached to all variable occurrences,  so you can call  on any open subterm. AThe kinds and types of primitives are added to the environments  automatically, you don''t need to supply these as part of the  starting environments. Like %, but check in an empty environment. JAs this function is not given an environment, the types of free variables 7 must be attached directly to the bound occurrences. # This attachment is performed by  above. Like  but using the  monad to manage errors. (Take the type of a witness constructor. 0Take the type of a builtin witness constructor. (Check a type in the exp checking monad. Static configuration. Starting Kind Environment. Strating Type Environment. Witness to check. Data type definitions. Kind environment. Type environment. Witness to check.  FNoneCheck a data constructor. F The data constructor must be in the set of data type declarations. (The full expression for error messages. Data constructor to check. GNone AThe type checker adds this annotation to every node in the AST, ( giving its type, effect and closure. #Type check an expression. If it'Cs good, you get a new version with types attached to all the bound 9 variables, as well its the type, effect and closure. If it'+s bad, you get a description of the error. IThe returned expression has types attached to all variable occurrences,  so you can call $ on any open subterm. AThe kinds and types of primitives are added to the environments  automatically, you don''t need to supply these as part of the  starting environments. $Like #3, but only return the value type of an expression. Like # but using the  monad to handle errors. Like #) but we allow naked types and witnesses. :Helper function for building the return value of checkExpM' G It builts the AnTEC annotation and attaches it to the new AST node, J as well as returning the current effect and closure in the appropriate  form as part of the tuple. Check some let bindings. =Take elements of a list that have more than once occurrence. Check a case alternative. AMerge a type annotation on a pattern field with a type we get by ' instantiating the constructor type. FCheck the set of witness bindings bound in a letregion for conflicts. CCheck the type annotation of a let bound variable against the type * inferred for the right of the binding. A If the annotation is Bot then we just replace the annotation, > otherwise it must match that for the right of the binding.  !"#Static configuration. Starting Kind environment. Strating Type environment. Expression to check. $Static configuration. Starting Kind environment Starting Type environment. Expression to check. Static config. Kind environment. Type environment. Expression to check. Static config. Kind environment. Type environment. Expression to check. *Enclosing expression, for error messages. Static config. Kind environment. Type environment. +Whole case expression, for error messages. Data type definitions. Kind environment. Type environment. Type of discriminant. *Args to type constructor of discriminant. Alternative to check. )Region variables bound in the letregion. (Other witness bindings in the same set. The witness binding to check.  !"#$ !"#$HNone%Type check a module. If it'Cs good, you get a new version with types attached to all the bound  variables If it'+s bad, you get a description of the error. Like % but using the  monad to handle errors. FCheck that the exported signatures match the types of their bindings. KIf some bind is exported, then check that it matches the exported version. BCheck that a top-level binding is actually defined by the module. (Check a type in the exp checking monad. %Static configuration. Module to check. Static configuration. Starting kind environment. Starting type environment. Module to check. Kinds of exported types. Types of exported values. "Environment of top-level bindings  defined by the module Kinds of exported types. Types of exported values. Types defined by the module. Name of an exported binding. %%Noner      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ !"#$%%#$ !"ZWURQNKJGEC@>=<;:97620/,+*)&#"!  [XYVVSTXOPOLMXXHIXFIXDXABXY?XDY?XDYXD?XY?XDBXD8XDYXD345X1XDX-.X-X-YXDX'(X$%X%XO?XOYHIFIXYXYXXXXXXX   X XXLXXB?XX'None&4Things that can go wrong when loading a core thing. ,0Parse and type check a core module from a file. -2Parse and type check a core module from a string. .$Parse and type check a core module. /Parse and check an expression 8 returning it along with its spec, effect and closure 0Parse and check a type, % returning it along with its kind. 1Parse and check a witness, % returning it along with its type. &'()*+,Language fragment profile. !Function to lex the source file. File containing source code. -Language fragment profile. !Function to lex the source file. (Path to source file for error messages. Program text. .Language fragment profile. (Path to source file for error messages. Source tokens. /Language fragment profile. "Other modules currently in scope. , We add their exports to the environment. (Path to source file for error messages. Source tokens. 0Language fragment profile. (Path to source file for error messages. Source tokens. 1Language fragment profile. (Path to source file for error messages. Source tokens.  !"&'()*+,-./01 !"&+*)(',-./01&+*)(',-./01(I(J(K(L(M(N(O(P(Q(R(S(T(U(V(W(X(Y(Z([(\(](^(_(`(a(b(c(d(e(f(g(h(i(j(k(l(m(n(o(p(q(r(s(t(u(v(w(w(x(y(z({(|(}(~((((((((((((((((((((((((**************++++++++++++++++++++++++++++++++      !"#$%&'()*+,-./01123456789:;<,=,>,?,@,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,[,\,],^,_,`,a,b,c,d,e,f,g,h i j k l m n o p q r s t u v w x y z { | } ~///                                                   1111111111111111111111111      !"#$%&'()*+,-./0123456666768696:6;6<6=6>6?6@6A6B6C6D6E6F6G6H6I6J6K6L6M6N6O6P6Q6R6S6T6U6V6W6X6Y6Z6[6\6]6^6_6`6a6b6c6d6e66f6g6h6i6j6k6l6m6n6o6p6q6r6s6t6u66v6w6x6y6z66{6|6}6666~66666666666666678888888888      !!"""""""""""########################################################################################< < < < < <<<====>>>@@6@7@@@@@AAACC C!D"%#%$%%%&%'%(%)%*%+%,%-%.%/%0%1&2&34456789:;E<E<E=E>E?E@EAEBECEDGEGEGFGGGHGIGJGKHL''M'N'O'P'Q'R'S'T'U'V'W)X)Y)Z)[)\)])^)_)`)a)b)cdefgheijklmnopqrstrsuvwxrsyz{e|}-~--------............./0        1     22233333333 3!3"3#3$3%3&3'3(3)4*44+4,4-4.4/0123456789:;<=>5?5@ABCDEFGHIJKL7M7N7O7P7Q7R7S7T8U8V8W8X8Y8Z8[8\8]^_`abcdefghij k l m n!o!p9q99r9s9t9u9v9w9x9y9z9{9|9}9~9999#########::::::::::::::::::;;;;<<<======>>?@AAAAAAAAAAAAAAAAAAAABBBBBBBCCCCCCCCCCCCCCCCDDD%&EEEEFGGGGGGGGGGGGGHHHHH'ddc-core-0.3.1.1 DDC.Type.ExpDDC.Core.Fragment DDC.Type.Sum DDC.Type.BindDDC.Type.DataDefDDC.Type.CheckDDC.Type.CompoundsDDC.Core.DaCon DDC.Core.ExpDDC.Type.PredicatesDDC.Type.Transform.RenameDDC.Type.Transform.LiftT DDC.Type.EnvDDC.Type.Transform.SpreadTDDC.Type.CollectDDC.Type.Transform.TrimDDC.Type.Transform.CrushDDC.Type.EquivDDC.Type.SubsumesDDC.Type.UniverseDDC.Type.Transform.SubstituteTDDC.Type.Transform.InstantiateDDC.Core.Transform.LiftXDDC.Core.ModuleDDC.Core.Transform.ReannotateDDC.Core.CompoundsDDC.Core.Transform.SpreadXDDC.Core.CheckDDC.Core.CollectDDC.Core.Transform.SubstituteTXDDC.Core.Transform.SubstituteWXDDC.Core.Transform.SubstituteXXDDC.Core.Transform.TrimDDC.Core.PredicatesDDC.Core.Lexer.TokensDDC.Core.ParserDDC.Core.Lexer.NamesDDC.Core.Lexer DDC.Core.LoadDDC.Type.Exp.BaseDDC.Type.Exp.NFDataDDC.Core.Fragment.FeatureDDC.Type.Check.ErrorDDC.Core.Exp.BaseDDC.Core.Exp.NFDataDDC.Type.PrettyDDC.Type.Check.CheckConDDC.Type.Check.ErrorMessageDDC.Core.Fragment.ProfileDDC.Type.Collect.FreeTDDC.Core.Check.TaggedClosureDDC.Core.Transform.LiftTDDC.Core.Transform.RenameDDC.Core.Check.ErrorDDC.Core.Collect.FreeDDC.Core.Collect.SupportDDC.Core.PrettyDDC.Core.Lexer.OffsideDDC.Core.Lexer.CommentsDDC.Core.Parser.BaseDDC.Core.Parser.TypeDDC.Core.Parser.WitnessDDC.Core.Check.ErrorMessageDDC.Core.Fragment.ErrorDDC.Core.Fragment.ComplianceDDC.Core.Parser.ParamDDC.Core.Parser.ExpDDC.Core.Parser.ModuleDDC.Core.Check.CheckWitnessDDC.Core.Check.CheckDaConDDC.Core.Check.CheckExpDDC.Core.Check.CheckModuleTcCon TcConDeepUseTcConUseTcConDeepAlloc TcConAllocTcConDeepWrite TcConWrite TcConDeepRead TcConHeadRead TcConReadTcConFun TcConUnitTwCon TwConDisjoint TwConManifest TwConHeadLazy TwConLazy TwConDistinctTwConDeepMutable TwConMutableTwConDeepConst TwConConstTwConDeepGlobal TwConGlobal TwConEmpty TwConPure TwConImplKiCon KiConClosure KiConEffect KiConRegion KiConData KiConWitnessKiConFunSoCon SoConComp SoConPropTyCon TyConBound TyConSpec TyConWitness TyConKind TyConSort TypeSumVarCon TypeSumCon TypeSumVar TyConHashTypeSum TypeSumSet typeSumElemstypeSumBoundNamedtypeSumBoundAnon typeSumSpill TypeSumBot typeSumKindClosureEffectRegionKindSortTypeTSumTAppTForallTConTVarBoundUPrimUNameUIxBindBNameBAnonBNoneBinderRNameRAnonRNoneFeature UnusedMatchesUnusedBindings NameShadowingUnboxedInstantiationUnboundLevel0VarsDebruijnBinders LazyBindingsNestedFunctionsGeneralApplicationPartialApplication PartialPrimsUntrackedClosuresUntrackedEffectsempty singletoneleminsertdeleteunionunions difference kindOfSumtoListfromList hashTyConhashTyConRange unhashTyCon getBindTypeDataCtor dataCtorName dataCtorTagdataCtorFieldTypesdataCtorTypeNameDataType dataTypeNamedataTypeParamKinds dataTypeModeDataMode DataModeLarge DataModeSmallDataDefs dataDefsTypes dataDefsCtorsDataDefdataDefTypeNamedataDefParamKinds dataDefCtors emptyDataDefs insertDataDeffromListDataDefslookupModeOfDataTypeErrorErrorWitnessImplInvalid errorLeftType errorLeftKinderrorRightTypeerrorRightKindErrorForallKindInvalid errorBodyErrorSumKindInvaliderrorCheckingSum errorKindErrorSumKindMismatcherrorKindExpected errorTypeSum errorKindsErrorAppNotFun errorFunTypeerrorFunTypeKind errorArgTypeerrorArgTypeKindErrorAppArgMismatch errorCheckingerrorParamKind errorArgKindErrorUnappliedKindFunErrorNakedSort errorSortErrorVarAnnotMismatch errorTypeEnvErrorUndefinedCtorErrorUndefined errorBoundtakeNameOfBind typeOfBindreplaceTypeOfBind binderOfBindmakeBindFromBinderpartitionBindsByTypetakeNameOfBoundboundMatchesBindnamedBoundMatchesBindtakeSubstBoundOfBindtakeSubstBoundsOfBindstIxtBottApp$:tApps takeTApps takeTyConAppstakePrimTyConAppstakeDataTyConAppstakePrimeRegiontForalltForalls takeTForalls eraseTForallstSumtUnitkFunkFunstakeKFun takeKFuns takeKFuns'takeResultKindtFuntakeTFuntakeTFunArgResulttakeTFunWitArgResult arityOfTypetFunPEtImplsCompsPropkDatakRegionkEffectkClosurekWitnesstRead tHeadRead tDeepReadtWrite tDeepWritetAlloc tDeepAlloctUsetDeepUsetPuretEmptytGlobal tDeepGlobaltConst tDeepConsttMutable tDeepMutable tDistincttLazy tHeadLazy tManifest tConData0 tConData1DaCon daConName daConTypedaConIsAlgebraic DaConName DaConNamed DaConUnittakeNameOfDaCon typeOfDaCondcUnit mkDaConAlg mkDaConSolidWbCon WbConAlloc WbConReadWbConUse WbConEmpty WbConPureWiCon WiConBound WiConBuiltinWitnessWTypeWJoinWAppWConWVarPatPDataPDefaultAltAAltLetModeLetLazy LetStrictLets LWithRegion LLetRegionsLRecLLetCast CastForget CastPurifyCastWeakenClosureCastWeakenEffectExpXWitnessXTypeXCastXCaseXLetXAppXLamXLAMXConXVarisBNoneisBAnonisBNameisTVarisBotisAtomT isDataKind isRegionKind isEffectKind isClosureKind isWitnessKind isAlgDataType isWitnessTypeisConstWitTypeisMutableWitTypeisDistinctWitType isReadEffect isWriteEffect isAllocEffectisSomeReadEffectisSomeWriteEffectisSomeAllocEffecttakeSortOfKiCon kindOfTwCon kindOfTcCon BindStack stackBindsstackAll stackAnons stackNamedSubsubBound subShadow0 subConflict1 subConflict0 subStack1 subStack0Rename renameWith pushBindspushBind substBoundbind1bind1sbind0bind0suse1use0 MapBoundTmapBoundAtDepthT liftAtDepthTliftT lowerAtDepthTlowerTTypeEnvKindEnvEnvenvMapenvStackenvStackLength envPrimFunextendextends setPrimFunisPrim fromTypeMapmember memberBindlookup lookupNamedepthlift wrapTForallsSpreadTspreadT BindStruct slurpBindTree BoundLevelBoundWitBoundExp BoundSpecBindWay BindCasePatBindLetRegionWithBindLetRegions BindLetRecBindLetBindLamBindLAM BindForallBindTreeBindConBindUseBindDeffreeT collectBound collectBinds isBoundExpWitboundLevelOfBindWaybindDefTFeaturesfeaturesUntrackedEffectsfeaturesUntrackedClosuresfeaturesPartialPrimsfeaturesPartialApplicationfeaturesGeneralApplicationfeaturesNestedFunctionsfeaturesLazyBindingsfeaturesDebruijnBindersfeaturesUnboundLevel0VarsfeaturesUnboxedInstantiationfeaturesNameShadowingfeaturesUnusedBindingsfeaturesUnusedMatchesProfile profileNameprofileFeaturesprofilePrimDataDefsprofilePrimKindsprofilePrimTypesprofileTypeIsUnboxed zeroProfile zeroFeatures checkType kindOfType trimClosure crushSomeT crushEffectequivTequivWithBindsT subsumesTUniverse UniverseDataUniverseWitness UniverseSpec UniverseKind UniverseSortuniverseFromType3universeFromType2universeFromType1universeOfType SubstituteTsubstituteWithT substituteT substituteTssubstituteBoundT instantiateT instantiateTs MapBoundXmapBoundAtDepthX liftAtDepthXliftX lowerAtDepthXlowerXQualName ModuleName ModuleMapModule ModuleCore moduleNamemoduleExportKindsmoduleExportTypesmoduleImportKindsmoduleImportTypes moduleBody isMainModule moduleKindEnv moduleTypeEnvmodulesGetBindsmodulesExportKindsmodulesExportTypesisMainModuleName Reannotate reannotatetakeAnnotOfExpxLAMsxLams takeXLAMs takeXLams makeXLamFlags takeXLamFlagsxAppsmakeXAppsWithAnnots takeXApps takeXApps1takeXAppsAsListtakeXAppsWithAnnots takeXPrimApps takeXConAppsxLets splitXLets bindsOfLetsspecBindsOfLetsvalwitBindsOfLetstakeCtorNameOfAlt bindsOfPatwAppwApps takeXWitnesstakeWAppsAsListtakePrimWiConApps takeXTypexUnitSpreadXspreadXErrorNakedWitnessErrorNakedTypeErrorWeakEffNotEffErrorCaseAltResultMismatch errorAltType1 errorAltType2ErrorCaseFieldTypeMismatcherrorTypeFieldErrorCaseScrutineeTypeMismatcherrorTypePatternErrorCaseCannotInstantiate errorTypeCtorErrorCaseTooManyBinderserrorCtorDaConerrorCtorFieldserrorPatternFieldsErrorCaseOverlappingErrorCaseNonExhaustiveLargeErrorCaseNonExhaustiveerrorCtorNamesMissingErrorCaseNoAlternatives ErrorCaseScrutineeTypeUndeclaredErrorCaseScrutineeNotAlgebraicerrorTypeScrutineeErrorWitnessNotEmptyErrorWitnessNotPurityErrorCannotJoinerrorWitnessLeft errorTypeLefterrorWitnessRighterrorTypeRightErrorWAppNotCtorErrorWAppMismatch errorWitnessErrorWithRegionFreeErrorWithRegionNotRegionErrorLetRegionWitnessFreeErrorLetRegionsWitnessOthererrorBoundRegionserrorBindWitnessErrorLetRegionWitnessConflicterrorBindWitness1errorBindWitness2ErrorLetRegionWitnessInvalidErrorLetRegionFreeErrorLetRegionsReboundErrorLetRegionsNotRegion errorBindsErrorLetrecReboundErrorLetrecBindingNotLambdaerrorExpErrorLetLazyWitnessTypeMismatcherrorWitnessTypeHave errorBindTypeerrorWitnessTypeExpectErrorLetLazyNoWitnessErrorLetLazyNotEmpty errorClosureErrorLetLazyNotPureErrorLetBodyNotDataErrorLetBindingNotDataErrorLetMismatchErrorLamBodyNotDataErrorLamBindNotDataErrorLamNotPureerrorSpecOrWit errorEffectErrorLamShadow errorBinderrorNotFunTypeErrorAppMismatcherrorParamTypeerrorTypeAnnotErrorUndefinedVar errorUniverseErrorMalformedExpErrorExportMismatcherrorExportType errorDefTypeErrorExportUndefined errorNameErrorMalformedType errorType ErrorTypeerrorTypeErrorfreeXSupportXsupportSupport supportTyConsupportTyConXArg supportSpVarsupportSpVarXArg supportWiVar supportDaVar SubstituteTXsubstituteWithTX substituteTX substituteTXssubstituteBoundTX SubstituteWXsubstituteWithWX substituteWX substituteWXs SubstituteXXsubstituteWithXX substituteXX substituteXXssubstituteXArgsubstituteXArgs trimClosurestrimXisXVarisXConisAtomXisAtomWisXLAMisXLam isLambdaXisXAppisXType isXWitness isPDefaultTokNamedKLitKVarKConTokAtom KTcConBuiltin KWbConBuiltin KTwConBuiltin KDaConUnitKIndexKElseKMatchKDoKForgetKPurifyKWeakCloKWeakEffKTypeKOfKCase KWithRegion KLetRegion KLetRegionsKLetRecKLazyKLetKInKWhereKWithKExportsKImportsKModule KBotClosure KBotEffect KArrowEqualsKArrowDashLeft KArrowDash KArrowTilde KKindWitness KKindClosure KKindEffect KKindRegion KKindValue KSortProp KSortComp KBigLambda KColonColonKDash KAmpersandKEquals KUnderscore KSemiColon KBackSlashKCommaKColonKPlusKHatKBarKDotKAngleColonKetKAngleColonBraKSquareColonKetKSquareColonBra KAngleKet KAngleBra KBraceKet KBraceBra KSquareKet KSquareBra KRoundKet KRoundBraTokMetaKOffsideClosingBraceKCommentUnterminatedKCommentBlockEndKCommentBlockStartKCommentLineStartKNewLineTokKNKAKMKJunk renameTok describeTokdescribeTokMetadescribeTokAtomdescribeTokNamedParserpNamepConpLitpVarpIndexpTokpTokAspTypepBinderpTypeApp pTypeAtompWitness pWitnessApp pWitnessAtomErrorUnusedBindErrorShadowedBindErrorUndefinedPrimErrorUnsupportedCompliescompliescompliesWithEnvspExppExpApppExpAtompModulekeywordsreadTwConBuiltinreadTcConBuiltinreadWbConBuiltin isVarName isVarStart isVarBodyreadVar isConName isConStart isConBodyreadCon isLitName isLitStart isLitBodylexModuleWithOffsidelexExpFragmentfragmentProfilefragmentExtensionfragmentReadNamefragmentLexModulefragmentLexExpfragmentCheckModulefragmentCheckExpConfigconfigPrimDataDefsconfigPrimKindsconfigPrimTypesconfigSuppressClosuresconfigOfProfile checkWitness typeOfWitness typeOfWiConAnTEC annotType annotEffect annotClosure annotTailcheckExp typeOfExp checkModuleErrorCompliance ErrorCheckExpErrorCheckType ErrorParser ErrorReadloadModuleFromFileloadModuleFromStringloadModuleFromTokensloadExploadType loadWitness $fNFDataTcCon $fNFDataTwCon $fNFDataKiCon $fNFDataSoCon $fNFDataTyCon$fNFDataTypeSumVarCon$fNFDataTyConHash$fNFDataTypeSum $fNFDataType $fNFDataBound $fNFDataBind$fNFDataBinderemptySetbase Data.MaybeNothing hashTcConGHC.ErrerrortakeSumArrayElemmakeSumArrayElem$fOrdTypeSumVarCon$fEqTypeSumVarCon $fOrdBound $fEqTypeSum$fEqTypeghc-prim GHC.TypesIntFalsetcCon1twCon1twCon2Float $fNFDataDaCon$fNFDataDaConNameGHC.Num* $fNFDataWbCon $fNFDataWiCon$fNFDataWitness $fNFDataPat $fNFDataAlt$fNFDataLetMode $fNFDataLets $fNFDataCast $fNFDataExp pprBinderSeppprBinderGroupstage $fPrettyTcCon $fPrettyTwCon $fPrettyKiCon $fPrettySoCon $fPrettyTyCon$fPrettyTypeSum $fPrettyType $fPrettyBound$fPrettyBinder $fPrettyBind wl-pprint-1.1Text.PrettyPrint.Leijen SimpleDocSLineSTextSCharSEmptylisttupled semiBraces encloseSep punctuatesepfillSephsepvsepcatfillCathcatvcat<><+><$><$$>softline softbreaksquotesdquotesbracesparensanglesbracketsencloselparenrparenlangleranglelbracerbracelbracketrbracketsquotedquotesemicoloncommaspacedot backslashequalsstringboolintintegerfloatdoublerational fillBreakfillwidthindenthangalignchartextline linebreaknestcolumnnestinggroup renderCompactdisplayS displayIOhPutDocDocddc-base-0.3.1.1DDC.Base.PrettyputDocLnputDoc renderIndent renderPlainrenderpprParenpprPrecpprPretty RenderPlain RenderIndent RenderModetakeKindOfTyCon $fPrettyError $fRenameBind$fRenameTypeSum $fRenameType countBAnons$fMapBoundTTypeSumn$fMapBoundTTypen$fMapBoundTBoundn$fMapBoundTBindn$fSpreadTTyCon$fSpreadTBound $fSpreadTBind$fSpreadTTypeSum $fSpreadTType freeOfTreeTcollectBoundOfTreecollectSpecBindsOfTreecollectExpBindsOfTree$fBindStructTyCon$fBindStructType setFeatureCheckM checkTypeM checkTypeM' trimToSumC trimDeepUsedDmakeUsed makeDeepRead makeDeepWrite makeDeepAllocmakeDeepGlobal checkBounds unpackSumT$fPrettyUniverse freeVarConT FreeVarConT$fFreeVarConTType$fSubstituteTTypeSum$fSubstituteTType$fSubstituteTBind TaggedClosure GBoundRgnCon GBoundRgnVar GBoundValclosureOfTaggedclosureOfTaggedSettaggedClosureOfValBoundtaggedClosureOfTyArgtaggedClosureOfWeakClomaskFromTaggedSetcutTaggedClosureTcutTaggedClosureXscutTaggedClosureX$fMapBoundTTaggedClosuren$fPrettyTaggedClosure$fOrdTaggedClosure$fEqTaggedClosuremapBoundAtDepthTLets$fMapBoundTAltn$fMapBoundTCastn$fMapBoundTWitnessn$fMapBoundTLetModen$fMapBoundTExpnmapBoundAtDepthXLets$fMapBoundXAltn$fMapBoundXCastn$fMapBoundXWitnessn$fMapBoundXLetModen$fMapBoundXExpn$fMapBoundXBoundn$fNFDataQualName$fNFDataModuleName$fNFDataModule$fReannotateCast$fReannotateAlt$fReannotateLets$fReannotateExp$fReannotateModule$fRenameWitness$fRenameLetMode$fSpreadXBound $fSpreadXBind$fSpreadXWiCon$fSpreadXWitness$fSpreadXLetMode $fSpreadXLets $fSpreadXAlt $fSpreadXPat $fSpreadXCast$fSpreadXDaCon $fSpreadXExp$fSpreadXModulebindDefX freeOfTreeX$fBindStructWitness$fBindStructAlt$fBindStructCast$fBindStructLetMode$fBindStructExp$fBindStructModule$fSupportXLetMode$fSupportXLets$fSupportXCast$fSupportXWitness $fSupportXAlt $fSupportXExp$fSupportXBind$fSupportXType$fMonoidSupport$fSubstituteTXType$fSubstituteTXBind$fSubstituteTXWitness$fSubstituteTXCast$fSubstituteTXAlt$fSubstituteTXLetMode$fSubstituteTXExpsubstW$fSubstituteWXWitness$fSubstituteWXCast$fSubstituteWXAlt$fSubstituteWXLetMode$fSubstituteWXExpsubstX$fSubstituteXXCast$fSubstituteXXAlt$fSubstituteXXExpfreeExp freeOfTreeExp pprPatBind pprParen' pprBinder breakWhen isSimpleXparens' $fPrettyWbCon $fPrettyWiCon$fPrettyWitness$fPrettyLetMode $fPrettyLets $fPrettyCast $fPrettyDaCon $fPrettyAlt $fPrettyPat $fPrettyExp$fPrettyModule$fPrettyModuleName TokenFamilydescribeTokenFamilyrenameTokNamedVariableIndex ConstructorKeywordSymboldescribeTokAtom'LexemeLexemeStartBlock applyOffside addStarts dropNewLinesdropNewLinesLexeme isBlockStartisToken isKNTokennewCBranewOffsideClosingBraceContextLexemeStartLine LexemeToken addStarts'newCKet newSemiColontakeTok dropCommentsdropCommentBlockpWbCon pModuleName pQualName pTypeForallpTypeFunpTcConpTwCon pTyConNamedpTypeSum pWitnessJoin pWitnessArg checkBind checkBinds checkFunction contextTopsetBodyaddArgresetthrowresultcontextAbsBodycontextFunArgs compliesX $fMonadCheckM $fCompliesAlt $fCompliesExp$fCompliesModule ParamSpecfunTypeOfParams expOfParamspBindParamSpec ParamValue ParamWitness ParamType pLetBindingpLetModepLetRecBindingpStmtpStmts makeStmtsStmtStmtNone StmtMatchStmtBindpArgspAltpPatpBindPatpLetspLetWitspTypeSigpImportKindSpecpImportTypeSpecreadTwConWithArity lexString$fShowFragment checkWitnessM typeOfWbCon checkDaConM checkExpM checkArgMreturnX checkLetsM duplicates checkAltM mergeAnnotcheckWitnessBindsMcheckLetBindOfTypeM checkExpM'checkWitnessBindM $fPrettyAnTEC $fNFDataAnTEC checkModuleMcheckModuleBindscheckModuleBindcheckBindDefined