úÎc\_k     J !"#$%&The ! datatype captures the result of  and can be used as the input to  (and ). The ? function use a depth-first preorder traversal to traverse the Oexpression trees. The edit script it outputs contains the operation that must @be applied to the constructor at that point: either keeping it (),  removing it (2, which does not remove the complete subtree, but  contracts >the edge of the removed node) or inserting a new constructor ( , which can Monly be done if the available subtrees at that point correspond to the types the constructor expects). (The  is only used when running  over an existing edit script.) -For more information about this datatype, you're advised to look at Eelco Lempsink' s thesis at  #http://eelco.lempsink.nl/thesis.pdf. '()*+C wraps both concrete and abstract constructors to a simple type so C constructors for a single type can be put together in a list, see   for # more information and an example. Use B for concrete constructors (e.g., for simple abstract datatypes). Use H for abstract constructors (e.g., for build-in types or types with many  (or infinite) constructors)  ?For each type in the family, you need to create an instance of   , listing =all the members of the family GADT which belong to one type. :This is step 4 of the four steps needed to be able to use  and . 1Steps 1-3 are explained in the documentation for  .  Continuing the example from the  " documentation, the instances for   are: ) instance Type ExprTermFamily Term where 3 constructors = [Concr Number', Concr Parens']  ) instance Type ExprTermFamily Expr where ! constructors = [Concr Min']  ( instance Type ExprTermFamily Int where ! constructors = [Abstr Int'] FList of constructors from the family GADT for one type in your family )Equality GADT, see the documentation for   for an example of its use. To use  and 3 on your datatypes, you must create an instance of  . .There are four steps to set up everything for  and .  C Define your datatypes. (Presumable, you already have done this.) = Create a family datatype, grouping your datatypes together. ) Make the family datatype an instance of    Create  * instances for each member of the family. LSteps 1-3 are explained below, step 4 is explained in the documentation for  . GAs a running example, we create a simple family of datatypes (step 1):   data Expr = Min Expr Term  data Term = Parens Expr  | Number Int JThe second step is creating the family datatype. Each constructor in the 5datatypes above gets a constructor in a family GADT:  * data ExprTermFamily :: * -> * -> * where K Min' :: ExprTermFamily Expr (Cons Expr (Cons Term Nil)) > Parens' :: ExprTermFamily Term (Cons Expr Nil) = Number' :: ExprTermFamily Term (Cons Int Nil) 2 Int' :: Int -> ExprTermFamily Int Nil JThe first type argument of the datatype must be the resulting type of the Jconstructor. The second argument captures the types of the arguments the &constructor expects. Note how to use  and  to create type level lists. The Int'; constructor is special, in the sense that it captures the , type abstractly (listing all Int'+s constructors would be quite impossible).  Caveat emptor;: polymorphic datatypes (like lists) are ill-supported and Prequire family constructors for each instance. It might require another master thesis project to solve this. )Step 3 is to create the instance for the   class. For each function you *will have to implement four functions. It's straightforward albeit a bit boring. & instance Family ExprTermFamily where @ decEq Min' Min' = Just (Refl, Refl) @ decEq Parens' Parens' = Just (Refl, Refl) @ decEq Number' Number' = Just (Refl, Refl) @ decEq (Int' x) (Int' y) | x == y = Just (Refl, Refl) 6 | otherwise = Nothing ) decEq _ _ = Nothing  B fields Min' (Min e t) = Just (CCons e (CCons t CNil)) 8 fields Parens' (Parens e) = Just (CCons e CNil) 8 fields Number' (Number i) = Just (CCons i CNil) . fields (Int' _) _ = Just CNil , fields _ _ = Nothing  9 apply Min' (CCons e (CCons t CNil)) = Min e t : apply Parens' (CCons e CNil) = Parens e : apply Number' (CCons i CNil) = Number i 3 apply (Int' i) CNil = i   string Min' = "Min" ! string Parens' = "Parens" ! string Number' = "Number"  string (Int' i) = show i )Return an instance of the equality GADT ( ) of the type and . constructor arguments are equal, else return -. 1When the constructor from the family matches the real constructor, ; return the arguments in a heterogeneous list, else return -. CWhen the constructor from the family and the heterogeneous list of  arguments match, apply the real constructor. For abstract / constructors, the list of arguments should be , but you project 2 out the value saved with the family constructor. For .&ing the constructors from the family. 0Datatype for type level lists, corresponding to '(:)'. Use when creating  your   instance. 0Datatype for type level lists, corresponding to '[]'. Use when creating  your   instance. (Edit script type for two single values.  Apply the edit script to value. KCalculate the difference between two values in the form of an edit script. See the documentation for  * for how to make your own data types work  with this function. Underlying implementation of &, works with (heterogeneous) lists of  values. Underlying implementation of &, works with (heterogeneous) lists of  values. /0123456789:;<=>?@ABCDEFGHIJKL      M      !"#$%&'()*+,-./01231456789:;<=>?@ABCDEFGHIJKLMNOPQRST gdiff-1.0Data.Generic.Diff EditScriptLEndCpyTreeCpyDelInsConAbstrConcrType constructors:=:ReflFamilydecEqfieldsapplystringConsCConsNilCNil EditScriptpatchdiffpatchLdiffLcompressEditScriptLMemoNNNCCNCCRListTRListNatSuccZeroAppendIsListIsConsIsNilListlistghc-prim GHC.TypesIntbase Data.MaybeNothingGHC.Showshow appendListappenddeleteisListinsertsplitmatchConstructorbeststeps bestStepsreifyinsdelcpycopied diffLMemo diffLMemo'getEditScriptLbestEditScriptLMemoextenddextendd'extendiextendi'extractd sourceTailextracti targetTailnccncc