?u      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrst (C) 2013 Hugo PachecoBSD-style (see below)!Hugo Pacheco <hpacheco@nii.ac.jp> provisionalNone !"+345;>FKLNYuvwxyz{|}~uvwxyz{|uvwxyz{|}~None !"+345;>FKLNYExpressions are patterns whose variable positions contain directions pointing into some environment. Their type is indexed by the environment type and the type of the expressed value.3Directions point to a variable position (marked by  }) in an environment. Their type is indexed by the environment type and the type of the variable position being pointed to. 5A marker for variable positions in environment types. The datatype of patterns is indexed by three types: the type of values to which a pattern is applicable, the type of environments resulting from pattern matching, and the type of containers used during inverse evaluation of expressions.A branch used in  L (whose type is parametrised by the source and view types) can be either  or &. The exit conditions specified in  branches should (ideally) be disjoint. Overlapping exit conditions are still allowed for fast prototyping, though  the putback semantics of   will compute successfully as long as the ranges of the branches are disjoint (regardless of whether the exit conditions are specified precisely enough).A  branch contains an inner program, which should update the source such that both the main condition (on both the source and view) and the exit condition (on the source) are satisfied.An W branch contains an adaptation function, which should modify the source such that a  branch is applicable.This is the datatype of BiGUL programs, as a GADT indexed with the source and view types. Most of the types appearing in a BiGUL program should be instances of  to enable error reporting. Before GHC 8, haddock does not support documentation for GADT constructors; for GHC 7.10.*, see the source for the description of each constructor and its arguments."  !"  !" !       !!None !"+345;>FKLNY""EPattern matching errors, which also explain where the matching fails.#@A constant pattern/expression is matched with a different value.$A & pattern/expression is matched with a  value.%A & pattern/expression is matched with a  value.&TOccurrences of the same variable in an expression are matched with different values.'[A variable that should appear at most once in an expression is however used multiple times.(OA variable that should appear at least once in an expression is however absent.)9The error is on the left of a product pattern/expression.*:The error is on the right of a product pattern/expression.+The error is inside a  pattern/expression.,The error is inside a  pattern/expression.-5The error is inside a constructor pattern/expression..Datatype of atomic errors./ is executed.0When executing Skip f on a source s, the view is not f s.1)The source does not match with a pattern.2'The view does not match with a pattern.3 The inverse rearrangement fails.4!The view cannot be reconstructed.5When executing Dep f _ on a view pair (v, v'), the second component v' is not f v.6No branch in a   statement is applicable.7AAfter adaptation, execution still goes into an adaptative branch.8mAfter execution of a branch, the computed source and view satisfy the main condition of a previous branch.9TAfter execution of a branch, the updated source fails to satisfy the exit condition.:\After execution of a branch, the computed source and view do not satisfy the main condition.;`The main condition is not satisfied by the source and view (and hence the branch is not chosen).<)The branch is adaptive and hence ignored.=uExecution traces, which log the operations executed, intermediate sources and views, and reasons of eventual failure.>)Execution successfully produces a result.?$Execution fails to produce a result.@6An intermediate step with the current source and view.A-An intermediate step with the current source.BInside a branch. *Notes that branch numbering starts from 0.CAll branches fail.%"#$%&'()*+,-./0123456789:;<=>?@ABCDEF""#$%&'()*+,-./0123456789:;<=>?@ABC%=>?@ABCF./0123456789:;<E"#$%&'()*+,-D" #$%&'()*+,-./0123456789:;<=>?@ABCDEFNone !"+345;>FKLNY GHIJKLMNOP GHIJKLMNOP GHIJKLMNOP GHIJKLMNOPNone !"+345;>FKLNYA _ monad with/modulo trace information  the monad laws hold only when the trace component is not considered.QThe putback semantics of a  program.RThe execution trace of a Q computation.SThe get semantics of a  program.TThe execution trace of a S computation.QRSTQRSTQRSTQRSTNone !"+345;>FKLNYU"The unsafe putback semantics of a  program.VThe unsafe get semantics of a  program.UVUVUVUVNone !"+345;>FKLNY view patternsource pattern expressionW Generate a    instance for a named datatype so that its constructors can be used in rearranging lambda-expressions. Invoke this function on a datatype T by putting deriveBiGULGeneric ''T@at the top level of a source file (say, after the definition of T). Only simple datatypes and newtypes are supported (no GADTs, for example); type parameters and named fields (record syntax) are supported.1translate all (VarE name) to directions using envXA higher-level syntax for , allowing its first and second arguments to be specified in terms of a simple lambda-expression. The usual way of using X is  $(rearrS [| f |]) b :: BiGUL s vwhere  f :: s -> s'# is a simple lambda-expression and b :: BiGUL s' v an inner program.YA higher-level syntax for , allowing its first and second arguments to be specified in terms of a simple lambda-expression. The usual way of using Y is  $(rearrV [| f |]) b :: BiGUL s vwhere  f :: v -> v'# is a simple lambda-expression and b :: BiGUL s v' an inner program. In f , wildcard _  is not allowed, and all pattern variables must be used in the body. (This is for ensuring that the view information is fully embedded into the source.)takes a source pattern and produces a tuple pattern consisting of all the variables in the source pattern 1:s:ss -> (() , (s, ss))Example: rearrSV [p| x:xs |] [p| x:xs |] [p| (x,xs) |] [d| x = Replace; xs = rec |] generates a rearrS from the first pattern and the third pattern and a rearrV from the second pattern and the third patternZA succinct syntax dealing with the frequently occurring situation where both the source and view are rearranged into products and their components further synchronised by inner updates. For example, the program M$(update [p| x:xs |] [p| x:xs |] [d| x = Replace; xs = b |]) :: BiGUL [a] [a][matches both the source and view lists with a cons pattern, marking their head and tail as x and xs3 respectively, and synchronises the heads using Replace' (which is the program associated with x6 in the declaration list) and the tails using some b :: BiGUL [a] [a](. In short, the program is equivalent to ^$(rearrS [| \(x:xs) -> (x, xs) |])$ $(rearrV [| \(x:xs) -> (x, xs) |])$ Replace `Prod` b(Admittedly, it is an abuse of syntax to represent a list of named BiGUL programs in terms of a declaration list, but it is the closest thing we can find that works directly with Template Haskell.)[Construct a normal branch, for which a main condition on the source and view and an exit condition on the source should be specified. The usual way of using [ is -$(normal [| p |] [| q |]) b :: CaseBranch s vwherep :: s -> v -> Bool,q :: s -> Bool, andb :: BiGUL s v, which is the branch body.\A special case of [ where the main condition is specified as the conjunction of two unary predicates on the source and view respectively. The usual way of using \ is 9$(normalSV [| ps |] [| pv |] [| q |]) b :: CaseBranch s vwhereps :: s -> Bool,pv :: v -> Bool,q :: s -> Bool, andb :: BiGUL s v, which is the branch body.]Construct an adaptive branch, for which a main condition on the source and view should be specified. The usual way of using ] is '$(adaptive [| p |]) f :: CaseBranch s vwherep :: s -> v -> Bool andf :: s -> v -> s#, which is the adaptation function.^A special case of ] where the main condition is specified as the conjunction of two unary predicates on the source and view respectively. The usual way of using ^ is 3$(adaptiveSV [| ps |] [| pv |]) f :: CaseBranch s vwhereps :: s -> Bool,pv :: v -> Bool, andf :: s -> v -> s#, which is the adaptation function.AWXrearranging lambda-expressionYrearranging lambda-expressionZsource pattern view pattern%named updates (as a declaration list)[8main condition (binary predicate on the source and view).exit condition (unary predicate on the source)\5main source condition (unary predicate on the source)1main view condition (unary predicate on the view).exit condition (unary predicate on the source)]8main condition (binary predicate on the source and view)^5main source condition (unary predicate on the source)1main view condition (unary predicate on the view)WXYZ[\]^WXYZ[\]^;WXYZ[\]^None !"+345;>FKLNY_JSkip updating the source when the view is known to be a constant. Same as  Skip . const.`WA nicer notation for applying a branch constructing function to a branch body. Same as .a8Embed a well-behaved pair of transformations into BiGUL._`a_`a_`a_`a`None !"+345;>FKLNYb alwaysFail = Fail "always fail"the combinator L will always fail all the transformation, reporting the given error message.get alwaysFail "Please succeed"Left fail: always failput alwaysFail 23 FalseLeft fail: always failc  constSquare = Skip (\s -> s * s)(Skip f) means that in the get direction, the view is fully computed by apply function f to the source. So in the put direction, the update is skipped and the source is unchanged. in the put direction, if (f source) /= view, an error is raised. the view is the square of the source.put constSquare 10 100Right 10put constSquare 10 225Left *** Exception blabla...get constSquare 5Right 25d )repFirst = Replace `Prod` Skip (const ())Rthe example shows a simplest case to chain basic constructors of BiGUL together. M is right associative with priority 1 (0 is the lowest, e.g. $ is 0) To use d, the source and view are assumed to be tuple. the first elements of both tuples are associated by , the second by ."put repFirst (False, 9) (True, ())Right (True,9)get repFirst (True, 3)Right (True,())e CrepFirst' = $(update [p| (x,_) |] [p| (x,()) |] [d| x = Replace |]) This is the d7 example rewritten with syntactic sugar. The syntax is L$(update [p| source-pattern |] [p| view-pattern |] [d| updating-strategy |])Source and view are decomposed by the patterns in the [p| ... |]. In this concrete example, the first elements of the tuple (both in the source and in the viwe) are bound to variable x, and they are sent to the combinator  as arguments by ( x=Replace7) in the [d| ... |] part. anything we want to perform o should be marked as underline(_) in the [p| source-pattern |] and it should not appear in the [d| ... |] part.GThe source-pattern and view-pattern can be very different, for example: 9$([p| Left x : _ |] [p| ((), x) |] [d| x = blabla... |])where the source-pattern stands for a non-empty list of Either type, and we bind variable x to the inner part of the Left constructor. However the view is a tuple, and we bind the second element to x. The rearrangement for source and view is automatically done.f @repFirstV2 = RearrV PVar' (EDir DVar `EProd` EConst ()) repFirstSkip to g- if you want to use the syntactic sugar only.In the previous example, suppose what we really want is that, the view has type a rather than (a,()). In order to do so, we can use , which first rearranges the view into the desired structure, and then uses another BiGUL program to perform the transformation. The usage of  is: 2RearrV (old-pattern) (new-pattern) (bigul-program)6 means there is a variable (a hole to be update), and  is the same as % except that it does not require the Q constraint. In this concrete example, since the view is a single variable, the  old-pattern is . X still means there is a variable. But DVar should be used in the second argument of the . Since there may be many variables in the old-pattern, we need to mark the origin of each variable in the new-pattern: where does it come from. In this concrete example, because there is only one variable in the old-pattern, a & is enough to locate it. Then we use  to make  becomes a direction,  it with a constant ? (). A more complex situation about the new-pattern is in the h example.g 3repFirstV2' = $(rearrV [| \v -> (v,()) |]) repFirstIt is difficult to use primitive combinators, especially when the problem becomes complex. Here we introduce another syntactic sugar: 9$(rearrV [| \old-pattern -> new-pattern |]) bigul-programBWhen rearranging the view, it's possible to duplicate information: ($(rearrV [| \v -> (v,v)|]) bigul-program but it's  not allowed to drop information: G$(rearrV [| \(vl,vr) -> vl |]) bigul-program -- this is WRONGh ErepFirstV3 = RearrS (PVar' `PProd` PVar') (EDir (DLeft DVar)) Replace1The function produces exactly the same result as f,. The difference is that, instead of using 2 to rearrange the view into a tuple, here we use L to rearrange the source into a single value of type a, and then simply use  to update the source. The usage of  is: 2RearrS (old-pattern) (new-pattern) (bigul-program)GThe original source is a tuple, that is to say, there are two variables. So the old-pattern is (PVar' `Prod` PVar'). In the new-pattern, We need to tell BiGUL that, it is the first element of the tuple, i.e. the left element, we want to update. This is achieved by (DLeft DVar). Finally, we convert it into a direction using .i 2repFirstV3' = $(rearrS [| \(l, _) -> l |]) Replace The syntactic sugar version for hK. The usage of the syntactic sugar is basically the same as $(rearrV ...): 9$(rearrS [| \old-pattern -> new-pattern |]) bigul-programj BrepFirstV4 = Dep (const ()) ($(rearrS [| \(l, _) -> l |]) Replace)Yet another version of d=. This artificial example briefly introduces the constructor  , which is rather seldom used. % can be used to add or eliminate information on the view. In this concrete example, since the second element of the view is a unit (()), it can be produced from any existing view v by (const ()), which is equivalent to (v -> const () v). Now we can consider a bidirectional transformation f &($(rearrS [| \(l, _) -> l |]) Replace)ywhich is between source (a,b) and view a only. Then both the transformation f and the function (const ()) are passed to A to finally produce the transformation between (a, b) and (a, ())k  Case [ $(normal [| \(a,b) c -> a <= b && c <= b |] [|\(a,b) -> a <= b |]) $(update [p| (a,_) |] [p| a |] [d| a = Replace |]) , $(normal [| \(a,b) c -> b < a && c < a |] [|\(a,b) -> b < a |]) $(update [p| (_,b) |] [p| b |] [d| b = Replace |]) , $(normal [|\ _ _ -> True|] [|\(a,b) -> False |]) (Fail "the source view are not consistent.") ]Here we introduce the  ( combinator, which is extremely useful.  T resembles the conditional branch in most languages. In this concrete example, the  H combinator enables us to do the following: Suppose the source is (a,b) and the view is c, if (a <= b && c <= b), then we replace a with c; if (b < a && c < a), then we replace b with c; otherwise, the program fails. Because in this case once the minimum element in the source is replaced, it is no longer the minimum element.The general structure for   is: Case [ $(normal [| enteringCond1 :: s -> v -> Bool |] [|exitCond1 :: s -> Bool |]) $ (bx1 :: BiGUL s v) , $(adaptive [| enteringCond1' :: s -> v -> Bool |]) $ (f1 :: s -> v -> s) , ... , $(normal [| enteringCondn :: s -> v -> Bool |] [|exitCond1 :: s -> Bool |]) $ (bxn :: BiGUL s v) , ... , $(adaptive [| enteringCondm' :: s -> v -> Bool |]) $ (fm :: s -> v -> s) ] :: BiGUL s vIt contains a sequence of cases. For each case, it is either normal or adaptive. For the normal case, if the condition is satisfied, a corresponding putback transformation is applied. For the adaptive case, if the condition is satisfied, a function is used to update the source with the view so that for the next step one of the normal cases can be applied. Note that if adaptation does not lead the source and the view to a normal case, an error will be reported at runtime. The example for adaptive branch is in the next example.^Note that $(normal ... ...) takes two predicates. The first one is the entering-condition while the second one is the exit-condition. The predicate for entering-condition is very general, and we can use any function f of type (s -> v -> Bool) to examine the source and view. If the condition is matched, then the BiGUL program after the predicate is executed. If the condition is not satisfied, the next branch is tried. The predicate for exit-condition checks the source only. The exit-condition in different branches should be always NOT overlapped. Eg: (a <= b), (b < a), (False) are not overlapped.VNote: instead of a general function, we can use patterns for predicate. The syntax is: $(normalSV [p| source-pattern |] [p| view-pattern |] [| exitCond |] ) ... $(adaptiveSV [p| source-pattern |] [p| view-pattern |]) For example: @$(normalSV [p| Left _:_ |] [p| [] |] [| exitCond |] )Gstates that the source is a non-empty list with the first element in a LeftR constructor, and the view is an empty list. This feature is heavily used in the q example.OPlease avoid using variables in the pattern-predicate: always use an underline.put replaceMin (2,7) 4 Right (4,7)put replaceMin (2,7) 10.Left fail: the source view are not consistent.get replaceMin (2,7)Right 2l UlensLength def = Case [ $(adaptive [| \s v -> length s /= v |]) (\s v -> let ls = length s in if ls > v then drop (ls - v) s else replicate (v - ls) def ++ s) , $(normal [|\s v -> length s == v |] [| const True |]) (Skip length) ]In this example, the source is any list and the view is the length of the source. Note that The function is not a lens: we should provide the function with a default value to make it a lens. The default value is used to generate new elements and thus expand the source, when the view is greater than the length of the source. If the view is less than the length of the source, the source will be shortened.)Here we introduce the adaptive branch of  %, which takes a predicate (just like  branch), and a function (f :: s -> v -> s) that is used to create a new source. Adaptive branch can be placed anywhere in a  Q. Once the adaptive branch is executed and the new source is created, the whole  h will be re-executed from the first branch. If again an adaptive branch is matched, an error is thrown.zAnother point is that, adaptive branch is chosen in the put direction only. In the get direction, it will never be chosen.put (lensLength 10) [2,2,1] 2 Right [2,1]put (lensLength 10) [2,2,1] 6Right [10,10,10,2,2,1]"get (lensLength undefined) [1..10]Right 10m lensLength' def = emb length p where p = \s v -> let ls = length s in if ls > v then drop (ls - v) s else replicate (v - ls) def ++ snIn fact what lensLength expresses is just that: We have two functions g and p, g is used to do the get (by a / branch), while p is used to do the put (by an W branch). this intention can be expressed in a more simple and modular way: using the o& (embed) function. the definition of o" can be found in the next example.n  (==>) = ($)Imake it more elegant to write ($). Later we may use (==>) instead of ($).o |emb g p = Case [ $(normal [| \s v -> g s == v |] [p| _ |]) ==> Skip g , $(adaptive [| \s v -> True |]) ==> p ]<emb g p: invoke g to do the get, and invoke p to do the put.p +lensSucc = emb (flip (+) 1) (\_ v -> v - 1) Sometimes o is useful. For instance, Int is a primitive datatype without any constructor in Haskell, and cannot be manipulated in a way like list in ReaarV or p. For list, we can write (x:xs) -> (x:x:xs) using its constructor. But we cannot decompose Int. Making use of o, we can manipulate basic operations for Int, whose well-behavedness should be proved by hand. (But here, the well-behavedness is easily seen.)put lensSucc 0 10Right 9get lensSucc 8Right 9q  naiveMap b = Case [ $(normalSV [p| _:_ |] [p| _:_ |] [p| _:_ |]) ==> $(update [p| x:xs |] [p| x:xs |] [d| x = b; xs = naiveMap b |]) , $(adaptiveSV [p| _:_ |] [p| [] |] ) (\_ _ -> []) , $(normalSV [p| [] |] [p| _:_ |] [| const False |]) ==> (Fail "length of the view should be less than that of the source.") , $(normalSV [p| [] |] [p| [] |] [p| [] |]) ==> $(update [p| [] |] [p| [] |] [d| |]) ]A naive map function, which takes a BiGUL program and yields another BiGUL program working on list. The first branch deals with recursive condition. The second branch handles the boundary conditions where the source list is longer than the view list: drop all the remaining elements in the source list and thus make it an empty list. The third branch will throw an error when the view list is longer than the source list. The last branch is the termination condition: both the source and view reach the empty constructor.((For the sake of completeness.) In fact \t means that we use separate condition for source and view. So we can still use a general function in the predicate: P$(normalSV [| \s -> case s of _:_ -> True; _ -> False |] [p| _:_ |] [p| _:_ |]))put (naiveMap lensSucc) [1,2,3,4] [7,8,9] Right [6,7,8]4get (naiveMap (lensLength undefined)) ["123", "xyz"] Right [3,3]1get (naiveMap replaceMin) [(3,9), (-2,10),(10,2)]Right [3,-2,2]r compose = Compose1The last combinator we are going to introduce is !J, which takes two BiGUL programs and behaves like "function composition".Given two BiGUL programs, f :: BiGUL a b, g :: BiGUL b cwe have f `Compose` g :: BiGUL a c'In the get direction, the semantics of get (f `Compose` g) s is: (suppose the function S and Q6 always return a value rather than a value wrapped in .) get g (get f s)'In the put direction, the semantics of put (f `Compose` g) s v is a little bit complex: put f s (put g (get f s) v)Let us make it more clear: /let a = get f s b = put g a v in put f s bTCheck the type of these transformations by yourself will help you understand deeper.Let us try some examples:Qput ((naiveMap replaceMin) `compose` (naiveMap lensSucc)) [(1,-1),(-2,2)] [-8, 1]Right [(1,-9),(0,2)]Iget ((naiveMap replaceMin) `compose` (naiveMap lensSucc)) [(1,-1),(-2,2)] Right [0,-1]sThe last example in this tutorial is a simple map-map fusion. It makes the composition of two map functions run more efficiently, compared to using ! combinator.kIn the get direction, (get (f `Compose` g)) traverse the list twice, while (get (mapFusion f g)) traverse the list only once. And in the put direction, (put f `Compose` g) traverse the two lists up to five times (get counts up once, two put count up four times, since a put takes two lists as argument), while (put mapFusion f g) traverses the lists only twice.&Compare the following result (in GHCI) t1 :: Int t1 = last $ fromRight $ put (naiveMap lensSucc `Compose` naiveMap lensSucc) [1..100000] [2..20001] t2 :: Int t2 = last $ fromRight $ put (mapFusion lensSucc lensSucc) [1..100000] [2..20001] fromRight (Right x) = xt119999(1.24 secs, 512,471,456 bytes)t219999(0.23 secs, 122,920,792 bytes)8More examples can be found in the list library of BiGUL.bcdefghijklmnopqrsbcdefghijklmnopqrsbcdefghijklmnopqrsbcdefghijklmnopqrs None !"+345;>FKLNYt~List alignment. Operating only on the sources satisfying the source condition, and using the specified matching condition, t finds for each view the first matching source that has not been matched with previous views, and updates the source using the inner program. If there is no matching source, one is created using the creation argument  after creation, the created source should match with the view as determined by the matching condition. For a source not matched with any view, the concealment argument is applied  if concealment computes to Nothing7, the source is deleted; if concealment computes to Just s', where s'G should not satisfy the source condition, the source is replaced by s'.tsource conditionmatching condition inner programcreation concealmentttt  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`]_abcdefghijklmnopqrstuvwjkxyz{ | } ~         BiGUL_G9aJzU1oieZLSLS0iPFEzpGenerics.BiGULGenerics.BiGUL.ErrorGenerics.BiGUL.PatternMatchingGenerics.BiGUL.Interpreter!Generics.BiGUL.Interpreter.UnsafeGenerics.BiGUL.THGenerics.BiGUL.LibGenerics.BiGUL.Lib.HuStudiesGenerics.BiGUL.Lib.List GHC.InOut GHC.GenericsGenericExprEDirEConstEProdELeftERightEIn DirectionDVarDLeftDRightVarPatPVarPVar'PConstPProdPLeftPRightPIn CaseBranchNormalAdaptiveBiGULFailSkipReplaceProdRearrSRearrVDepCaseComposePatErrorPEConstantMismatchPELeftMismatchPERightMismatchPEIncompatibleUpdatesPEMultipleUpdatesPEValueUnrecoverablePEProdLPEProdRPELeftPERightPEIn BiGULErrorBEFailBESkipMismatchBESourcePatternMismatchBEViewPatternMismatchBEInvRearrFailedBEViewRecoveringFailedBEDependencyMismatchBECaseExhaustedBEAdaptiveBranchRevisitedBEPreviousBranchMatchedBEExitConditionFailedBEPostVerificationFailedBEBranchUnmatchedBEAdaptiveBranchMatched BiGULTrace BTSuccessBTErrorBTNextSVBTNextSBTBranch BTBranches$fShowPatError$fShowBiGULError$fShowBiGULTrace modifyError deconstruct constructretrieveevaluneval unevalDirfromContainerVfromContainerSemptyContainerputputTracegetgetTracederiveBiGULGenericrearrSrearrVupdatenormalnormalSVadaptive adaptiveSVskip==>emb alwaysFail constSquarerepFirst repFirst' repFirstV2 repFirstV2' repFirstV3 repFirstV3' repFirstV4 replaceMin lensLength lensLength'lensSuccnaiveMapcompose mapFusionalign ToFromRepfromReptoRepFFlattenInOutinnout$fInOuta$fToFromRep:*:$fToFromRep:+: $fToFromRepM1 $fToFromRepK1 $fToFromRepU1TFCo:R:Flatten:*:TFCo:R:Flatten:+:TFCo:R:FlattenM1TFCo:R:FlattenK1TFCo:R:FlattenU1baseGHC.ShowShow Data.EitherLeftRight BiGULResultGHC.BaseMayberunBiGULResult catchBind errorResult modifyTrace embedEither incrBranchNoaddCurrentBranchTrace putWithTrace getCaseBranchputCaseCheckDiversionputCaseWithAdaptationputCase getWithTracegetCase$fMonadBiGULResult$fApplicativeBiGULResult$fFunctorBiGULResult fromRightRTagSTagETag rearrangeExpmkProdPatFromSrearrSVExpOrPattoExp ErrorMessageValueConstructorTypeConstructor NamespacePatTagConTagLR astNamespacecontag lookupName lookupNamesconstructorsToSumconstructorToProductconstructorToPatAndBody zipWithLRs consToEnvconstructFuncFromClauseconstructFuncToClausegenerateSelectorNamesgenerateSelectorDataDgenerateSelectorDataTypegenerateSelectorDataType'generateSelectorInstanceDecgenerateSelectorInstanceDec'generateTypeVarsType constructLRs lookupLRslookupRecordLengthlookupRecordFieldmkConstrutorFromLRsmkPat mkEnvForRearrsplitDataAndConmkBodyExpForRearrrearr' getAllVars mkExpFromPat mkExpFromPat' toProductmkProdPatFromSHelpermkEnvForUpdatepatCond nameAdaptive nameNormalpatLambdaToPred $fExpOrPatQ $fExpOrPatQ0 $fShowPatTag$ghc-prim GHC.ClassesEq