ol?      !"#$%&'()*+,-./0123456789:;<=>Safe+DOT?0-like class for 1-type-parameter GADTs. Unlike 3, this one cannot be mechanically derived from a ? instance because , must choose the phantom type based on the @ being parsed.GReadS t is equivalent to +ReadS (forall b. (forall a. t a -> b) -> b)#, which is in turn equivalent to ReadS (Exists t) (with -data Exists t where Exists :: t a -> Exists t)A)-like class for 1-type-parameter GADTs. GShow t => ..." is equivalent to something like (forall a. Show (t a)) => ...R. The easiest way to create instances would probably be to write (or derive) an instance Show (T a), and then simply say: -instance GShow t where gshowsPrec = showsPrec      Safe%&+09:;DOQRTType class for comparable GADT-like structures. When 2 things are equal, must return a witness that their parameter types are equal as well ().A type for the result of comparing GADT constructors; the type parameters of the GADT values being compared are included so that in the case where they are equal their parameter types can be unified.A class for type-contexts which contain enough information to (at least in some cases) decide the equality of types occurring within them.2Produce a witness of type-equality, if one exists.NA handy idiom for using this would be to pattern-bind in the Maybe monad, eg.: pextract :: GEq tag => tag a -> DSum tag -> Maybe a extract t1 (t2 :=> x) = do Refl <- geq t1 t2 return xOr in a list comprehension: extractMany :: GEq tag => tag a -> [DSum tag] -> [a] extractMany t1 things = [ x | (t2 :=> x) <- things, Refl <- maybeToList (geq t1 t2)](Making use of the DSum type from Data.Dependent.Sum in both examples)JBackwards compatibility alias; as of GHC 7.8, this is the same as `(:~:)`.If f has a M instance, this function makes a suitable default implementation of '(==)'.If f has a M instance, this function makes a suitable default implementation of '(/=)'.TODO: Think of a better name.This operation forgets the phantom types of a  value. !"##"!  !"#Safe%&+DOT$%&'()*$%&$%&*)('$%&'()*Safe%&+09:;<=ADQRT+In order to compare  DSum tag f values, tag? must know how to compare both itself and its tagged values. += defines the interface by which they are expected to do so.Continuing the Tag example from the - section, we can define: instance GCompare Tag where gcompare AString AString = GEQ gcompare AString AnInt = GLT gcompare AnInt AString = GGT gcompare AnInt AnInt = GEQ instance OrdTag Tag [] where compareTagged AString AString = compare compareTagged AnInt AnInt = compareAs with ., ,% only needs to consider cases where  returns .,Given two values of type tag a (for which  returns ), return the B function for the type f a.-In order to test  DSum tag f for equality, tagI must know how to test both itself and its tagged values for equality. -< defines the interface by which they are expected to do so.Continuing the Tag example from the 3 section, we can define: instance GEq Tag where geq AString AString = Just Refl geq AnInt AnInt = Just Refl geq _ _ = Nothing instance EqTag Tag [] where eqTagged AString AString = (==) eqTagged AnInt AnInt = (==) Note that .f is not called until after the tags have been compared, so it only needs to consider the cases where  returns ..Given two values of type tag a (for which  returns ), return the C function for the type f a.1In order to make a A instance for  DSum tag f, tagH must be able to show itself as well as any value of the tagged type. H together with this class provides the interface by which it can do so.ShowTag tag f => tG is conceptually equivalent to something like this imaginary syntax: 0(forall a. Inhabited (tag a) => Show (f a)) => t , where  InhabitedE is an imaginary predicate that characterizes non-empty types, and f and a do not occur free in t.The Tag example type introduced in the 3? section could be given the following instances, among others: instance GShow Tag where gshowsPrec _p AString = showString "AString" gshowsPrec _p AnInt = showString "AnInt" instance ShowTag Tag [] where showTaggedPrec AString = showsPrec showTaggedPrec AnInt = showsPrec2Given a value of type tag a , return the D function for the type f a.3A basic dependent sum type; the first component is a tag that specifies the type of the second; for example, think of a GADT such as: ?data Tag a where AString :: Tag String AnInt :: Tag Int6Then, we have the following valid expressions of type Applicative f => DSum Tag f: #AString ==> "hello!" AnInt ==> 42(And we can write functions that consume  DSum Tag f values by matching, such as: toString :: DSum Tag Identity -> String toString (AString :=> Identity str) = str toString (AnInt :=> Identity int) = show intBy analogy to the (key => value) construction for dictionary entries in many dynamic languages, we use (key :=> value) as the constructor for dependent sums. The :=> and ==> operators have very low precedence and bind to the right, so if the Tag2 GADT is extended with an additional constructor Rec :: Tag (DSum Tag Identity), then Rec ==> AnInt ==> 3 + 4" is parsed as would be expected (Rec ==> (AnInt ==> (3 + 4))) and has type DSum Identity Tag(. Its precedence is just above that of E, so foo bar $ AString ==> "eep" is equivalent to foo bar (AString ==> "eep").;In order to make a ? instance for  DSum tag f, tagI must be able to parse itself as well as any value of the tagged type. H together with this class provides the interface by which it can do so.ReadTag tag f => tG is conceptually equivalent to something like this imaginary syntax: 0(forall a. Inhabited (tag a) => Read (f a)) => t , where  InhabitedE is an imaginary predicate that characterizes non-empty types, and f and a do not occur free in t.The Tag example type introduced in the 3? section could be given the following instances, among others: Ninstance GRead Tag where greadsPrec _p str = case tag of "AString" -> [(\k -> k AString, rest)] "AnInt" -> [(\k -> k AnInt, rest)] _ -> [] where (tag, rest) = break isSpace str instance ReadTag Tag [] where readTaggedPrec AString = readsPrec readTaggedPrec AnInt = readsPrec+,-./0123456789:;<=> +,-./01234534512>=</0;:-.98+,76+,-./0123456789:;<=>4151F       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMKLNIOGPQ(dependent-sum-0.4-Ecmfe7aOpiJDdCCDitXqiZData.GADT.CompareData.GADT.Show Data.SomeData.Dependent.SumbaseData.Type.EqualityRefl:~:GRead greadsPrecGReadS GReadResultgetGReadResultGShow gshowsPrecgshowsgshowgreadsgreadGComparegcompare GOrderingGLTGEQGGTGEqgeq:= defaultEq defaultNeqweakenOrderingdefaultCompare$fGComparek:~:$fGReadkGOrdering$fGShowkGOrdering$fShowGOrdering$fOrdGOrdering $fEqGOrdering $fGEqk:~: $fGReadk:~: $fGShowk:~:SomeThiswithSome $fOrdSome$fEqSome $fReadSome $fShowSomeOrdTag compareTaggedEqTageqTaggedReadTagreadTaggedPrecShowTagshowTaggedPrecDSum:=>==> $fOrdDSum $fOrdTagk:~:f$fEqDSum $fEqTagk:~:f $fReadDSum$fReadTagk:~:f $fShowDSum$fShowTagkGOrderingf$fShowTagk:~:fGHC.ReadReadGHC.BaseStringGHC.ShowShowghc-prim GHC.Classescompare== showsPrec$