-- For GHC version 7.10 or higher {-# LANGUAGE GADTs, KindSignatures, DataKinds #-} {-# LANGUAGE LambdaCase #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} {-# OPTIONS_GHC -fno-warn-overlapping-patterns #-} module AbsCore ( Tree(..) , Module , Tdef , MaybeTy , Cdef , Tyt , Vdefg , Vdef , Exp , Bind , Alt , Vbind , Tbind , ATbind , Ty , Kind , Lit , QualIdent , Ident , johnMajorEq , module ComposOpCore ) where import Prelude ((.), (>), (&&), (==)) import Prelude ((.), (>), (&&), (==)) import qualified Prelude as P import ComposOpCore data Tag = Module_ | Tdef_ | MaybeTy_ | Cdef_ | Tyt_ | Vdefg_ | Vdef_ | Exp_ | Bind_ | Alt_ | Vbind_ | Tbind_ | ATbind_ | Ty_ | Kind_ | Lit_ | QualIdent_ | Ident_ type Module = Tree 'Module_ type Tdef = Tree 'Tdef_ type MaybeTy = Tree 'MaybeTy_ type Cdef = Tree 'Cdef_ type Tyt = Tree 'Tyt_ type Vdefg = Tree 'Vdefg_ type Vdef = Tree 'Vdef_ type Exp = Tree 'Exp_ type Bind = Tree 'Bind_ type Alt = Tree 'Alt_ type Vbind = Tree 'Vbind_ type Tbind = Tree 'Tbind_ type ATbind = Tree 'ATbind_ type Ty = Tree 'Ty_ type Kind = Tree 'Kind_ type Lit = Tree 'Lit_ type QualIdent = Tree 'QualIdent_ type Ident = Tree 'Ident_ data Tree (a :: Tag) where Module :: Ident -> [Tdef] -> [Vdefg] -> Tree 'Module_ Data :: QualIdent -> [Tbind] -> [Cdef] -> Tree 'Tdef_ Newtype :: QualIdent -> [Tbind] -> MaybeTy -> Tree 'Tdef_ JustTy :: Ty -> Tree 'MaybeTy_ NoTy :: Tree 'MaybeTy_ Constr :: QualIdent -> [ATbind] -> [Tyt] -> Tree 'Cdef_ TT :: Ty -> Tree 'Tyt_ Nonrec :: Vdef -> Tree 'Vdefg_ Rec :: [Vdef] -> Tree 'Vdefg_ VdefQ :: QualIdent -> Ty -> Exp -> Tree 'Vdef_ VdefU :: Ident -> Ty -> Exp -> Tree 'Vdef_ App :: Exp -> Exp -> Tree 'Exp_ Appt :: Exp -> Ty -> Tree 'Exp_ Case :: Exp -> Vbind -> [Alt] -> Tree 'Exp_ Coerce :: Ty -> Exp -> Tree 'Exp_ Dcon :: QualIdent -> Tree 'Exp_ External :: P.String -> Ty -> Tree 'Exp_ Lams :: [Bind] -> Exp -> Tree 'Exp_ Let :: Vdefg -> Exp -> Tree 'Exp_ Litc :: Lit -> Tree 'Exp_ Note :: P.String -> Exp -> Tree 'Exp_ Var :: Ident -> Tree 'Exp_ Tb :: Tbind -> Tree 'Bind_ Vb :: Vbind -> Tree 'Bind_ Acon :: QualIdent -> [ATbind] -> [Vbind] -> Exp -> Tree 'Alt_ Adefault :: Exp -> Tree 'Alt_ Alit :: Lit -> Exp -> Tree 'Alt_ Vbind :: Ident -> Ty -> Tree 'Vbind_ TbindLift :: Ident -> Tree 'Tbind_ TbindPair :: Ident -> Kind -> Tree 'Tbind_ ATbind :: Tbind -> Tree 'ATbind_ TArrow :: Ty -> Ty -> Tree 'Ty_ Tapp :: Ty -> Ty -> Tree 'Ty_ Tcon :: QualIdent -> Tree 'Ty_ Tforalls :: [Tbind] -> Ty -> Tree 'Ty_ Tvar :: Ident -> Tree 'Ty_ Karrow :: Kind -> Kind -> Tree 'Kind_ Klifted :: Tree 'Kind_ Kopen :: Tree 'Kind_ Kunlifted :: Tree 'Kind_ Lchar :: P.Char -> Ty -> Tree 'Lit_ Lint :: P.Integer -> Ty -> Tree 'Lit_ Lrational :: P.Double -> Ty -> Tree 'Lit_ Lstring :: P.String -> Ty -> Tree 'Lit_ Qual :: Ident -> Ident -> Tree 'QualIdent_ Ident ::P.String -> Tree 'Ident_ instance Compos Tree where compos r a f = \case Module x tdefs vdefgs -> r Module `a` f x `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) tdefs `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) vdefgs Data qualIdent tbinds cdefs -> r Data `a` f qualIdent `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) tbinds `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) cdefs Newtype qualIdent tbinds maybeTy -> r Newtype `a` f qualIdent `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) tbinds `a` f maybeTy JustTy ty -> r JustTy `a` f ty Constr qualIdent aTbinds tyts -> r Constr `a` f qualIdent `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) aTbinds `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) tyts TT ty -> r TT `a` f ty Nonrec vdef -> r Nonrec `a` f vdef Rec vdefs -> r Rec `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) vdefs VdefQ qualIdent ty exp -> r VdefQ `a` f qualIdent `a` f ty `a` f exp VdefU x ty exp -> r VdefU `a` f x `a` f ty `a` f exp App exp1 exp2 -> r App `a` f exp1 `a` f exp2 Appt exp ty -> r Appt `a` f exp `a` f ty Case exp vbind alts -> r Case `a` f exp `a` f vbind `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) alts Coerce ty exp -> r Coerce `a` f ty `a` f exp Dcon qualIdent -> r Dcon `a` f qualIdent External str ty -> r External `a` r str `a` f ty Lams binds exp -> r Lams `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) binds `a` f exp Let vdefg exp -> r Let `a` f vdefg `a` f exp Litc lit -> r Litc `a` f lit Note str exp -> r Note `a` r str `a` f exp Var x -> r Var `a` f x Tb tbind -> r Tb `a` f tbind Vb vbind -> r Vb `a` f vbind Acon qualIdent aTbinds vbinds exp -> r Acon `a` f qualIdent `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) aTbinds `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) vbinds `a` f exp Adefault exp -> r Adefault `a` f exp Alit lit exp -> r Alit `a` f lit `a` f exp Vbind x ty -> r Vbind `a` f x `a` f ty TbindLift x -> r TbindLift `a` f x TbindPair x kind -> r TbindPair `a` f x `a` f kind ATbind tbind -> r ATbind `a` f tbind TArrow ty1 ty2 -> r TArrow `a` f ty1 `a` f ty2 Tapp ty1 ty2 -> r Tapp `a` f ty1 `a` f ty2 Tcon qualIdent -> r Tcon `a` f qualIdent Tforalls tbinds ty -> r Tforalls `a` P.foldr (\ x z -> r (:) `a` f x `a` z) (r []) tbinds `a` f ty Tvar x -> r Tvar `a` f x Karrow kind1 kind2 -> r Karrow `a` f kind1 `a` f kind2 Lchar c ty -> r Lchar `a` r c `a` f ty Lint n ty -> r Lint `a` r n `a` f ty Lrational d ty -> r Lrational `a` r d `a` f ty Lstring str ty -> r Lstring `a` r str `a` f ty Qual x1 x2 -> r Qual `a` f x1 `a` f x2 t -> r t instance P.Show (Tree c) where showsPrec n = \case Ident str -> opar . P.showString "Ident" . P.showChar ' ' . P.showsPrec 1 str . cpar Module x tdefs vdefgs -> opar . P.showString "Module" . P.showChar ' ' . P.showsPrec 1 x . P.showChar ' ' . P.showsPrec 1 tdefs . P.showChar ' ' . P.showsPrec 1 vdefgs . cpar Data qualIdent tbinds cdefs -> opar . P.showString "Data" . P.showChar ' ' . P.showsPrec 1 qualIdent . P.showChar ' ' . P.showsPrec 1 tbinds . P.showChar ' ' . P.showsPrec 1 cdefs . cpar Newtype qualIdent tbinds maybeTy -> opar . P.showString "Newtype" . P.showChar ' ' . P.showsPrec 1 qualIdent . P.showChar ' ' . P.showsPrec 1 tbinds . P.showChar ' ' . P.showsPrec 1 maybeTy . cpar JustTy ty -> opar . P.showString "JustTy" . P.showChar ' ' . P.showsPrec 1 ty . cpar NoTy -> P.showString "NoTy" Constr qualIdent aTbinds tyts -> opar . P.showString "Constr" . P.showChar ' ' . P.showsPrec 1 qualIdent . P.showChar ' ' . P.showsPrec 1 aTbinds . P.showChar ' ' . P.showsPrec 1 tyts . cpar TT ty -> opar . P.showString "TT" . P.showChar ' ' . P.showsPrec 1 ty . cpar Nonrec vdef -> opar . P.showString "Nonrec" . P.showChar ' ' . P.showsPrec 1 vdef . cpar Rec vdefs -> opar . P.showString "Rec" . P.showChar ' ' . P.showsPrec 1 vdefs . cpar VdefQ qualIdent ty exp -> opar . P.showString "VdefQ" . P.showChar ' ' . P.showsPrec 1 qualIdent . P.showChar ' ' . P.showsPrec 1 ty . P.showChar ' ' . P.showsPrec 1 exp . cpar VdefU x ty exp -> opar . P.showString "VdefU" . P.showChar ' ' . P.showsPrec 1 x . P.showChar ' ' . P.showsPrec 1 ty . P.showChar ' ' . P.showsPrec 1 exp . cpar App exp1 exp2 -> opar . P.showString "App" . P.showChar ' ' . P.showsPrec 1 exp1 . P.showChar ' ' . P.showsPrec 1 exp2 . cpar Appt exp ty -> opar . P.showString "Appt" . P.showChar ' ' . P.showsPrec 1 exp . P.showChar ' ' . P.showsPrec 1 ty . cpar Case exp vbind alts -> opar . P.showString "Case" . P.showChar ' ' . P.showsPrec 1 exp . P.showChar ' ' . P.showsPrec 1 vbind . P.showChar ' ' . P.showsPrec 1 alts . cpar Coerce ty exp -> opar . P.showString "Coerce" . P.showChar ' ' . P.showsPrec 1 ty . P.showChar ' ' . P.showsPrec 1 exp . cpar Dcon qualIdent -> opar . P.showString "Dcon" . P.showChar ' ' . P.showsPrec 1 qualIdent . cpar External str ty -> opar . P.showString "External" . P.showChar ' ' . P.showsPrec 1 str . P.showChar ' ' . P.showsPrec 1 ty . cpar Lams binds exp -> opar . P.showString "Lams" . P.showChar ' ' . P.showsPrec 1 binds . P.showChar ' ' . P.showsPrec 1 exp . cpar Let vdefg exp -> opar . P.showString "Let" . P.showChar ' ' . P.showsPrec 1 vdefg . P.showChar ' ' . P.showsPrec 1 exp . cpar Litc lit -> opar . P.showString "Litc" . P.showChar ' ' . P.showsPrec 1 lit . cpar Note str exp -> opar . P.showString "Note" . P.showChar ' ' . P.showsPrec 1 str . P.showChar ' ' . P.showsPrec 1 exp . cpar Var x -> opar . P.showString "Var" . P.showChar ' ' . P.showsPrec 1 x . cpar Tb tbind -> opar . P.showString "Tb" . P.showChar ' ' . P.showsPrec 1 tbind . cpar Vb vbind -> opar . P.showString "Vb" . P.showChar ' ' . P.showsPrec 1 vbind . cpar Acon qualIdent aTbinds vbinds exp -> opar . P.showString "Acon" . P.showChar ' ' . P.showsPrec 1 qualIdent . P.showChar ' ' . P.showsPrec 1 aTbinds . P.showChar ' ' . P.showsPrec 1 vbinds . P.showChar ' ' . P.showsPrec 1 exp . cpar Adefault exp -> opar . P.showString "Adefault" . P.showChar ' ' . P.showsPrec 1 exp . cpar Alit lit exp -> opar . P.showString "Alit" . P.showChar ' ' . P.showsPrec 1 lit . P.showChar ' ' . P.showsPrec 1 exp . cpar Vbind x ty -> opar . P.showString "Vbind" . P.showChar ' ' . P.showsPrec 1 x . P.showChar ' ' . P.showsPrec 1 ty . cpar TbindLift x -> opar . P.showString "TbindLift" . P.showChar ' ' . P.showsPrec 1 x . cpar TbindPair x kind -> opar . P.showString "TbindPair" . P.showChar ' ' . P.showsPrec 1 x . P.showChar ' ' . P.showsPrec 1 kind . cpar ATbind tbind -> opar . P.showString "ATbind" . P.showChar ' ' . P.showsPrec 1 tbind . cpar TArrow ty1 ty2 -> opar . P.showString "TArrow" . P.showChar ' ' . P.showsPrec 1 ty1 . P.showChar ' ' . P.showsPrec 1 ty2 . cpar Tapp ty1 ty2 -> opar . P.showString "Tapp" . P.showChar ' ' . P.showsPrec 1 ty1 . P.showChar ' ' . P.showsPrec 1 ty2 . cpar Tcon qualIdent -> opar . P.showString "Tcon" . P.showChar ' ' . P.showsPrec 1 qualIdent . cpar Tforalls tbinds ty -> opar . P.showString "Tforalls" . P.showChar ' ' . P.showsPrec 1 tbinds . P.showChar ' ' . P.showsPrec 1 ty . cpar Tvar x -> opar . P.showString "Tvar" . P.showChar ' ' . P.showsPrec 1 x . cpar Karrow kind1 kind2 -> opar . P.showString "Karrow" . P.showChar ' ' . P.showsPrec 1 kind1 . P.showChar ' ' . P.showsPrec 1 kind2 . cpar Klifted -> P.showString "Klifted" Kopen -> P.showString "Kopen" Kunlifted -> P.showString "Kunlifted" Lchar c ty -> opar . P.showString "Lchar" . P.showChar ' ' . P.showsPrec 1 c . P.showChar ' ' . P.showsPrec 1 ty . cpar Lint n ty -> opar . P.showString "Lint" . P.showChar ' ' . P.showsPrec 1 n . P.showChar ' ' . P.showsPrec 1 ty . cpar Lrational d ty -> opar . P.showString "Lrational" . P.showChar ' ' . P.showsPrec 1 d . P.showChar ' ' . P.showsPrec 1 ty . cpar Lstring str ty -> opar . P.showString "Lstring" . P.showChar ' ' . P.showsPrec 1 str . P.showChar ' ' . P.showsPrec 1 ty . cpar Qual x1 x2 -> opar . P.showString "Qual" . P.showChar ' ' . P.showsPrec 1 x1 . P.showChar ' ' . P.showsPrec 1 x2 . cpar where opar = if n > 0 then P.showChar '(' else P.id cpar = if n > 0 then P.showChar ')' else P.id instance P.Eq (Tree c) where (==) = johnMajorEq instance P.Ord (Tree c) where compare x y = P.compare (index x) (index y) `P.mappend` compareSame x y index :: Tree c -> P.Int index (Module _ _ _) = 1 index (Data _ _ _) = 2 index (Newtype _ _ _) = 3 index (JustTy _) = 4 index (NoTy ) = 5 index (Constr _ _ _) = 6 index (TT _) = 7 index (Nonrec _) = 8 index (Rec _) = 9 index (VdefQ _ _ _) = 10 index (VdefU _ _ _) = 11 index (App _ _) = 12 index (Appt _ _) = 13 index (Case _ _ _) = 14 index (Coerce _ _) = 15 index (Dcon _) = 16 index (External _ _) = 17 index (Lams _ _) = 18 index (Let _ _) = 19 index (Litc _) = 20 index (Note _ _) = 21 index (Var _) = 22 index (Tb _) = 23 index (Vb _) = 24 index (Acon _ _ _ _) = 25 index (Adefault _) = 26 index (Alit _ _) = 27 index (Vbind _ _) = 28 index (TbindLift _) = 29 index (TbindPair _ _) = 30 index (ATbind _) = 31 index (TArrow _ _) = 32 index (Tapp _ _) = 33 index (Tcon _) = 34 index (Tforalls _ _) = 35 index (Tvar _) = 36 index (Karrow _ _) = 37 index (Klifted ) = 38 index (Kopen ) = 39 index (Kunlifted ) = 40 index (Lchar _ _) = 41 index (Lint _ _) = 42 index (Lrational _ _) = 43 index (Lstring _ _) = 44 index (Qual _ _) = 45 index (Ident _) = 46 johnMajorEq :: Tree a -> Tree b -> P.Bool johnMajorEq (Module x tdefs vdefgs) (Module x_ tdefs_ vdefgs_) = x == x_ && tdefs == tdefs_ && vdefgs == vdefgs_ johnMajorEq (Data qualIdent tbinds cdefs) (Data qualIdent_ tbinds_ cdefs_) = qualIdent == qualIdent_ && tbinds == tbinds_ && cdefs == cdefs_ johnMajorEq (Newtype qualIdent tbinds maybeTy) (Newtype qualIdent_ tbinds_ maybeTy_) = qualIdent == qualIdent_ && tbinds == tbinds_ && maybeTy == maybeTy_ johnMajorEq (JustTy ty) (JustTy ty_) = ty == ty_ johnMajorEq NoTy NoTy = P.True johnMajorEq (Constr qualIdent aTbinds tyts) (Constr qualIdent_ aTbinds_ tyts_) = qualIdent == qualIdent_ && aTbinds == aTbinds_ && tyts == tyts_ johnMajorEq (TT ty) (TT ty_) = ty == ty_ johnMajorEq (Nonrec vdef) (Nonrec vdef_) = vdef == vdef_ johnMajorEq (Rec vdefs) (Rec vdefs_) = vdefs == vdefs_ johnMajorEq (VdefQ qualIdent ty exp) (VdefQ qualIdent_ ty_ exp_) = qualIdent == qualIdent_ && ty == ty_ && exp == exp_ johnMajorEq (VdefU x ty exp) (VdefU x_ ty_ exp_) = x == x_ && ty == ty_ && exp == exp_ johnMajorEq (App exp1 exp2) (App exp1_ exp2_) = exp1 == exp1_ && exp2 == exp2_ johnMajorEq (Appt exp ty) (Appt exp_ ty_) = exp == exp_ && ty == ty_ johnMajorEq (Case exp vbind alts) (Case exp_ vbind_ alts_) = exp == exp_ && vbind == vbind_ && alts == alts_ johnMajorEq (Coerce ty exp) (Coerce ty_ exp_) = ty == ty_ && exp == exp_ johnMajorEq (Dcon qualIdent) (Dcon qualIdent_) = qualIdent == qualIdent_ johnMajorEq (External str ty) (External str_ ty_) = str == str_ && ty == ty_ johnMajorEq (Lams binds exp) (Lams binds_ exp_) = binds == binds_ && exp == exp_ johnMajorEq (Let vdefg exp) (Let vdefg_ exp_) = vdefg == vdefg_ && exp == exp_ johnMajorEq (Litc lit) (Litc lit_) = lit == lit_ johnMajorEq (Note str exp) (Note str_ exp_) = str == str_ && exp == exp_ johnMajorEq (Var x) (Var x_) = x == x_ johnMajorEq (Tb tbind) (Tb tbind_) = tbind == tbind_ johnMajorEq (Vb vbind) (Vb vbind_) = vbind == vbind_ johnMajorEq (Acon qualIdent aTbinds vbinds exp) (Acon qualIdent_ aTbinds_ vbinds_ exp_) = qualIdent == qualIdent_ && aTbinds == aTbinds_ && vbinds == vbinds_ && exp == exp_ johnMajorEq (Adefault exp) (Adefault exp_) = exp == exp_ johnMajorEq (Alit lit exp) (Alit lit_ exp_) = lit == lit_ && exp == exp_ johnMajorEq (Vbind x ty) (Vbind x_ ty_) = x == x_ && ty == ty_ johnMajorEq (TbindLift x) (TbindLift x_) = x == x_ johnMajorEq (TbindPair x kind) (TbindPair x_ kind_) = x == x_ && kind == kind_ johnMajorEq (ATbind tbind) (ATbind tbind_) = tbind == tbind_ johnMajorEq (TArrow ty1 ty2) (TArrow ty1_ ty2_) = ty1 == ty1_ && ty2 == ty2_ johnMajorEq (Tapp ty1 ty2) (Tapp ty1_ ty2_) = ty1 == ty1_ && ty2 == ty2_ johnMajorEq (Tcon qualIdent) (Tcon qualIdent_) = qualIdent == qualIdent_ johnMajorEq (Tforalls tbinds ty) (Tforalls tbinds_ ty_) = tbinds == tbinds_ && ty == ty_ johnMajorEq (Tvar x) (Tvar x_) = x == x_ johnMajorEq (Karrow kind1 kind2) (Karrow kind1_ kind2_) = kind1 == kind1_ && kind2 == kind2_ johnMajorEq Klifted Klifted = P.True johnMajorEq Kopen Kopen = P.True johnMajorEq Kunlifted Kunlifted = P.True johnMajorEq (Lchar c ty) (Lchar c_ ty_) = c == c_ && ty == ty_ johnMajorEq (Lint n ty) (Lint n_ ty_) = n == n_ && ty == ty_ johnMajorEq (Lrational d ty) (Lrational d_ ty_) = d == d_ && ty == ty_ johnMajorEq (Lstring str ty) (Lstring str_ ty_) = str == str_ && ty == ty_ johnMajorEq (Qual x1 x2) (Qual x1_ x2_) = x1 == x1_ && x2 == x2_ johnMajorEq (Ident str) (Ident str_) = str == str_ johnMajorEq _ _ = P.False compareSame :: Tree c -> Tree c -> P.Ordering compareSame (Module x tdefs vdefgs) (Module x_ tdefs_ vdefgs_) = P.mappend (P.compare x x_) (P.mappend (P.compare tdefs tdefs_) (P.compare vdefgs vdefgs_)) compareSame (Data qualIdent tbinds cdefs) (Data qualIdent_ tbinds_ cdefs_) = P.mappend (P.compare qualIdent qualIdent_) (P.mappend (P.compare tbinds tbinds_) (P.compare cdefs cdefs_)) compareSame (Newtype qualIdent tbinds maybeTy) (Newtype qualIdent_ tbinds_ maybeTy_) = P.mappend (P.compare qualIdent qualIdent_) (P.mappend (P.compare tbinds tbinds_) (P.compare maybeTy maybeTy_)) compareSame (JustTy ty) (JustTy ty_) = P.compare ty ty_ compareSame NoTy NoTy = P.EQ compareSame (Constr qualIdent aTbinds tyts) (Constr qualIdent_ aTbinds_ tyts_) = P.mappend (P.compare qualIdent qualIdent_) (P.mappend (P.compare aTbinds aTbinds_) (P.compare tyts tyts_)) compareSame (TT ty) (TT ty_) = P.compare ty ty_ compareSame (Nonrec vdef) (Nonrec vdef_) = P.compare vdef vdef_ compareSame (Rec vdefs) (Rec vdefs_) = P.compare vdefs vdefs_ compareSame (VdefQ qualIdent ty exp) (VdefQ qualIdent_ ty_ exp_) = P.mappend (P.compare qualIdent qualIdent_) (P.mappend (P.compare ty ty_) (P.compare exp exp_)) compareSame (VdefU x ty exp) (VdefU x_ ty_ exp_) = P.mappend (P.compare x x_) (P.mappend (P.compare ty ty_) (P.compare exp exp_)) compareSame (App exp1 exp2) (App exp1_ exp2_) = P.mappend (P.compare exp1 exp1_) (P.compare exp2 exp2_) compareSame (Appt exp ty) (Appt exp_ ty_) = P.mappend (P.compare exp exp_) (P.compare ty ty_) compareSame (Case exp vbind alts) (Case exp_ vbind_ alts_) = P.mappend (P.compare exp exp_) (P.mappend (P.compare vbind vbind_) (P.compare alts alts_)) compareSame (Coerce ty exp) (Coerce ty_ exp_) = P.mappend (P.compare ty ty_) (P.compare exp exp_) compareSame (Dcon qualIdent) (Dcon qualIdent_) = P.compare qualIdent qualIdent_ compareSame (External str ty) (External str_ ty_) = P.mappend (P.compare str str_) (P.compare ty ty_) compareSame (Lams binds exp) (Lams binds_ exp_) = P.mappend (P.compare binds binds_) (P.compare exp exp_) compareSame (Let vdefg exp) (Let vdefg_ exp_) = P.mappend (P.compare vdefg vdefg_) (P.compare exp exp_) compareSame (Litc lit) (Litc lit_) = P.compare lit lit_ compareSame (Note str exp) (Note str_ exp_) = P.mappend (P.compare str str_) (P.compare exp exp_) compareSame (Var x) (Var x_) = P.compare x x_ compareSame (Tb tbind) (Tb tbind_) = P.compare tbind tbind_ compareSame (Vb vbind) (Vb vbind_) = P.compare vbind vbind_ compareSame (Acon qualIdent aTbinds vbinds exp) (Acon qualIdent_ aTbinds_ vbinds_ exp_) = P.mappend (P.compare qualIdent qualIdent_) (P.mappend (P.compare aTbinds aTbinds_) (P.mappend (P.compare vbinds vbinds_) (P.compare exp exp_))) compareSame (Adefault exp) (Adefault exp_) = P.compare exp exp_ compareSame (Alit lit exp) (Alit lit_ exp_) = P.mappend (P.compare lit lit_) (P.compare exp exp_) compareSame (Vbind x ty) (Vbind x_ ty_) = P.mappend (P.compare x x_) (P.compare ty ty_) compareSame (TbindLift x) (TbindLift x_) = P.compare x x_ compareSame (TbindPair x kind) (TbindPair x_ kind_) = P.mappend (P.compare x x_) (P.compare kind kind_) compareSame (ATbind tbind) (ATbind tbind_) = P.compare tbind tbind_ compareSame (TArrow ty1 ty2) (TArrow ty1_ ty2_) = P.mappend (P.compare ty1 ty1_) (P.compare ty2 ty2_) compareSame (Tapp ty1 ty2) (Tapp ty1_ ty2_) = P.mappend (P.compare ty1 ty1_) (P.compare ty2 ty2_) compareSame (Tcon qualIdent) (Tcon qualIdent_) = P.compare qualIdent qualIdent_ compareSame (Tforalls tbinds ty) (Tforalls tbinds_ ty_) = P.mappend (P.compare tbinds tbinds_) (P.compare ty ty_) compareSame (Tvar x) (Tvar x_) = P.compare x x_ compareSame (Karrow kind1 kind2) (Karrow kind1_ kind2_) = P.mappend (P.compare kind1 kind1_) (P.compare kind2 kind2_) compareSame Klifted Klifted = P.EQ compareSame Kopen Kopen = P.EQ compareSame Kunlifted Kunlifted = P.EQ compareSame (Lchar c ty) (Lchar c_ ty_) = P.mappend (P.compare c c_) (P.compare ty ty_) compareSame (Lint n ty) (Lint n_ ty_) = P.mappend (P.compare n n_) (P.compare ty ty_) compareSame (Lrational d ty) (Lrational d_ ty_) = P.mappend (P.compare d d_) (P.compare ty ty_) compareSame (Lstring str ty) (Lstring str_ ty_) = P.mappend (P.compare str str_) (P.compare ty ty_) compareSame (Qual x1 x2) (Qual x1_ x2_) = P.mappend (P.compare x1 x1_) (P.compare x2 x2_) compareSame (Ident str) (Ident str_) = P.compare str str_ compareSame _ _ = P.error "BNFC error: compareSame"