úÎaN]     None!"2468=HJKMThe ! 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 expression 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 (x, which can only 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.† wraps both concrete and abstract constructors to a simple type so 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 algebraic datatypes).Use  d for abstract constructors (e.g., for built-in types or types with many (or infinite) constructors) ?For each type in the family, you need to create an instance of  F, 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 3. Steps 1-3 are explained in the documentation for  . Continuing the example from the  " documentation, the instances for   are: êinstance Type ExprTermFamily Term where constructors = [Concr Number', Concr Parens'] instance Type ExprTermFamily Expr where constructors = [Concr Min'] instance Type ExprTermFamily Int where constructors = [Abstr Int'] EList of constructors from the family GADT for one type in your family To use  and 3 on your datatypes, you must create an instance of  ..There are four steps to set up everything for  and . ADefine your datatypes. (Presumably, 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  .FAs a running example, we create a simple family of datatypes (step 1): Ndata Expr = Min Expr Term data Term = Parens Expr | Number Int~The second step is creating the family datatype. Each constructor in the datatypes above gets a constructor in a family GADT: ÿdata ExprTermFamily :: * -> * -> * where Min' :: ExprTermFamily Expr (Cons Expr (Cons Term Nil)) Parens' :: ExprTermFamily Term (Cons Expr Nil) Number' :: ExprTermFamily Term (Cons Int Nil) Int' :: Int -> ExprTermFamily Int NilºThe first type argument of the datatype must be the resulting type of the constructor. 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 require family constructors for each instance. It might require another master thesis project to solve this.)Step 3 is to create the instance for the  p 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) | otherwise = Nothing decEq _ _ = Nothing fields Min' (Min e t) = Just (CCons e (CCons t CNil)) fields Parens' (Parens e) = Just (CCons e CNil) fields Number' (Number i) = Just (CCons i CNil) fields (Int' _) _ = Just CNil fields _ _ = Nothing apply Min' (CCons e (CCons t CNil)) = Min e t apply Parens' (CCons e CNil) = Parens e apply Number' (CCons i CNil) = Number i 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 realI constructor, return the arguments in a heterogeneous list, else return ._When the constructor from the family and the heterogeneous list of arguments match, apply the realK constructor. For abstract constructors, the list of arguments should be C, but you project out the value saved with the family constructor.For %ing the constructors from the family.PDatatype for type level lists, corresponding to '(:)'. Use when creating your   instance.ODatatype for type level lists, corresponding to '[]'. Use when creating your   instance.'Edit script type for two single values.!Apply the edit script to a value.JCalculate 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.M !"#$%&'()*+,-. /0123456789:;<=>?@ABCDEFGHIJKLMNOPQ    5#"! $%&(')*,+-.  /0123456789:;<=>?@ABCDEFGHIJKLMNOPQR      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ gdiff-1.1Data.Generic.DiffbaseData.Type.EqualityRefl:~: EditScriptLEndCpyTreeCpyDelInsConAbstrConcrType constructorsFamilydecEqfieldsapplystringConsCConsNilCNil EditScriptpatchdiffpatchLdiffLcompressghc-prim GHC.TypesInt Data.MaybeNothingGHC.ShowshowEditScriptLMemoNNNCCNCCRListTRListNatSuccZeroAppendIsListIsConsIsNilListlist appendListappenddeleteisListinsertsplitmatchConstructorbeststeps bestStepsreifyinsdelcpycopied diffLMemo diffLMemo'getEditScriptLbestEditScriptLMemoextenddextendd'extendiextendi'extractd sourceTailextracti targetTailnccncc$fShowEditScriptLTFCo:R:AppendConstysTFCo:R:AppendNiltys $fListfCons $fListfNil