singletons-2.4: tests/compile-and-dump/Singletons/Classes.ghc84.template
Singletons/Classes.hs:(0,0)-(0,0): Splicing declarations
singletons
[d| infix 4 <=>
const :: a -> b -> a
const x _ = x
fooCompare :: Foo -> Foo -> Ordering
fooCompare A A = EQ
fooCompare A B = LT
fooCompare B B = GT
fooCompare B A = EQ
class MyOrd a where
mycompare :: a -> a -> Ordering
(<=>) :: a -> a -> Ordering
(<=>) = mycompare
infix 4 <=>
data Foo = A | B
data Foo2 = F | G
instance MyOrd () where
mycompare _ = const EQ
instance MyOrd Nat where
Zero `mycompare` Zero = EQ
Zero `mycompare` (Succ _) = LT
(Succ _) `mycompare` Zero = GT
(Succ n) `mycompare` (Succ m) = m `mycompare` n
instance MyOrd Foo where
mycompare = fooCompare
instance Eq Foo2 where
F == F = True
G == G = True
F == G = False
G == F = False |]
======>
const :: a -> b -> a
const x _ = x
class MyOrd a where
mycompare :: a -> a -> Ordering
(<=>) :: a -> a -> Ordering
(<=>) = mycompare
infix 4 <=>
instance MyOrd Nat where
mycompare Zero Zero = EQ
mycompare Zero (Succ _) = LT
mycompare (Succ _) Zero = GT
mycompare (Succ n) (Succ m) = (m `mycompare` n)
instance MyOrd () where
mycompare _ = const EQ
data Foo = A | B
fooCompare :: Foo -> Foo -> Ordering
fooCompare A A = EQ
fooCompare A B = LT
fooCompare B B = GT
fooCompare B A = EQ
instance MyOrd Foo where
mycompare = fooCompare
data Foo2 = F | G
instance Eq Foo2 where
(==) F F = True
(==) G G = True
(==) F G = False
(==) G F = False
type ASym0 = A
type BSym0 = B
type FSym0 = F
type GSym0 = G
type FooCompareSym2 (t :: Foo) (t :: Foo) = FooCompare t t
instance SuppressUnusedWarnings FooCompareSym1 where
suppressUnusedWarnings
= snd ((GHC.Tuple.(,) FooCompareSym1KindInference) GHC.Tuple.())
data FooCompareSym1 (l :: Foo) (l :: TyFun Foo Ordering)
= forall arg. SameKind (Apply (FooCompareSym1 l) arg) (FooCompareSym2 l arg) =>
FooCompareSym1KindInference
type instance Apply (FooCompareSym1 l) l = FooCompare l l
instance SuppressUnusedWarnings FooCompareSym0 where
suppressUnusedWarnings
= snd ((GHC.Tuple.(,) FooCompareSym0KindInference) GHC.Tuple.())
data FooCompareSym0 (l :: TyFun Foo (TyFun Foo Ordering
-> GHC.Types.Type))
= forall arg. SameKind (Apply FooCompareSym0 arg) (FooCompareSym1 arg) =>
FooCompareSym0KindInference
type instance Apply FooCompareSym0 l = FooCompareSym1 l
type ConstSym2 (t :: a0123456789876543210) (t :: b0123456789876543210) =
Const t t
instance SuppressUnusedWarnings ConstSym1 where
suppressUnusedWarnings
= snd ((GHC.Tuple.(,) ConstSym1KindInference) GHC.Tuple.())
data ConstSym1 (l :: a0123456789876543210) (l :: TyFun b0123456789876543210 a0123456789876543210)
= forall arg. SameKind (Apply (ConstSym1 l) arg) (ConstSym2 l arg) =>
ConstSym1KindInference
type instance Apply (ConstSym1 l) l = Const l l
instance SuppressUnusedWarnings ConstSym0 where
suppressUnusedWarnings
= snd ((GHC.Tuple.(,) ConstSym0KindInference) GHC.Tuple.())
data ConstSym0 (l :: TyFun a0123456789876543210 (TyFun b0123456789876543210 a0123456789876543210
-> GHC.Types.Type))
= forall arg. SameKind (Apply ConstSym0 arg) (ConstSym1 arg) =>
ConstSym0KindInference
type instance Apply ConstSym0 l = ConstSym1 l
type family FooCompare (a :: Foo) (a :: Foo) :: Ordering where
FooCompare A A = EQSym0
FooCompare A B = LTSym0
FooCompare B B = GTSym0
FooCompare B A = EQSym0
type family Const (a :: a) (a :: b) :: a where
Const x _ = x
type MycompareSym2 (t :: a0123456789876543210) (t :: a0123456789876543210) =
Mycompare t t
instance SuppressUnusedWarnings MycompareSym1 where
suppressUnusedWarnings
= snd ((GHC.Tuple.(,) MycompareSym1KindInference) GHC.Tuple.())
data MycompareSym1 (l :: a0123456789876543210) (l :: TyFun a0123456789876543210 Ordering)
= forall arg. SameKind (Apply (MycompareSym1 l) arg) (MycompareSym2 l arg) =>
MycompareSym1KindInference
type instance Apply (MycompareSym1 l) l = Mycompare l l
instance SuppressUnusedWarnings MycompareSym0 where
suppressUnusedWarnings
= snd ((GHC.Tuple.(,) MycompareSym0KindInference) GHC.Tuple.())
data MycompareSym0 (l :: TyFun a0123456789876543210 (TyFun a0123456789876543210 Ordering
-> GHC.Types.Type))
= forall arg. SameKind (Apply MycompareSym0 arg) (MycompareSym1 arg) =>
MycompareSym0KindInference
type instance Apply MycompareSym0 l = MycompareSym1 l
type (<=>@#@$$$) (t :: a0123456789876543210) (t :: a0123456789876543210) =
(<=>) t t
instance SuppressUnusedWarnings (<=>@#@$$) where
suppressUnusedWarnings
= snd ((GHC.Tuple.(,) (:<=>@#@$$###)) GHC.Tuple.())
data (<=>@#@$$) (l :: a0123456789876543210) (l :: TyFun a0123456789876543210 Ordering)
= forall arg. SameKind (Apply ((<=>@#@$$) l) arg) ((<=>@#@$$$) l arg) =>
(:<=>@#@$$###)
type instance Apply ((<=>@#@$$) l) l = (<=>) l l
instance SuppressUnusedWarnings (<=>@#@$) where
suppressUnusedWarnings
= snd ((GHC.Tuple.(,) (:<=>@#@$###)) GHC.Tuple.())
data (<=>@#@$) (l :: TyFun a0123456789876543210 (TyFun a0123456789876543210 Ordering
-> GHC.Types.Type))
= forall arg. SameKind (Apply (<=>@#@$) arg) ((<=>@#@$$) arg) =>
(:<=>@#@$###)
type instance Apply (<=>@#@$) l = (<=>@#@$$) l
type family TFHelper_0123456789876543210 (a :: a) (a :: a) :: Ordering where
TFHelper_0123456789876543210 a_0123456789876543210 a_0123456789876543210 = Apply (Apply MycompareSym0 a_0123456789876543210) a_0123456789876543210
type TFHelper_0123456789876543210Sym2 (t :: a0123456789876543210) (t :: a0123456789876543210) =
TFHelper_0123456789876543210 t t
instance SuppressUnusedWarnings TFHelper_0123456789876543210Sym1 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) TFHelper_0123456789876543210Sym1KindInference)
GHC.Tuple.())
data TFHelper_0123456789876543210Sym1 (l :: a0123456789876543210) (l :: TyFun a0123456789876543210 Ordering)
= forall arg. SameKind (Apply (TFHelper_0123456789876543210Sym1 l) arg) (TFHelper_0123456789876543210Sym2 l arg) =>
TFHelper_0123456789876543210Sym1KindInference
type instance Apply (TFHelper_0123456789876543210Sym1 l) l = TFHelper_0123456789876543210 l l
instance SuppressUnusedWarnings TFHelper_0123456789876543210Sym0 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) TFHelper_0123456789876543210Sym0KindInference)
GHC.Tuple.())
data TFHelper_0123456789876543210Sym0 (l :: TyFun a0123456789876543210 (TyFun a0123456789876543210 Ordering
-> GHC.Types.Type))
= forall arg. SameKind (Apply TFHelper_0123456789876543210Sym0 arg) (TFHelper_0123456789876543210Sym1 arg) =>
TFHelper_0123456789876543210Sym0KindInference
type instance Apply TFHelper_0123456789876543210Sym0 l = TFHelper_0123456789876543210Sym1 l
class PMyOrd (a :: GHC.Types.Type) where
type Mycompare (arg :: a) (arg :: a) :: Ordering
type (<=>) (arg :: a) (arg :: a) :: Ordering
type (<=>) a a = Apply (Apply TFHelper_0123456789876543210Sym0 a) a
type family Mycompare_0123456789876543210 (a :: Nat) (a :: Nat) :: Ordering where
Mycompare_0123456789876543210 Zero Zero = EQSym0
Mycompare_0123456789876543210 Zero (Succ _) = LTSym0
Mycompare_0123456789876543210 (Succ _) Zero = GTSym0
Mycompare_0123456789876543210 (Succ n) (Succ m) = Apply (Apply MycompareSym0 m) n
type Mycompare_0123456789876543210Sym2 (t :: Nat) (t :: Nat) =
Mycompare_0123456789876543210 t t
instance SuppressUnusedWarnings Mycompare_0123456789876543210Sym1 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Mycompare_0123456789876543210Sym1KindInference)
GHC.Tuple.())
data Mycompare_0123456789876543210Sym1 (l :: Nat) (l :: TyFun Nat Ordering)
= forall arg. SameKind (Apply (Mycompare_0123456789876543210Sym1 l) arg) (Mycompare_0123456789876543210Sym2 l arg) =>
Mycompare_0123456789876543210Sym1KindInference
type instance Apply (Mycompare_0123456789876543210Sym1 l) l = Mycompare_0123456789876543210 l l
instance SuppressUnusedWarnings Mycompare_0123456789876543210Sym0 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Mycompare_0123456789876543210Sym0KindInference)
GHC.Tuple.())
data Mycompare_0123456789876543210Sym0 (l :: TyFun Nat (TyFun Nat Ordering
-> GHC.Types.Type))
= forall arg. SameKind (Apply Mycompare_0123456789876543210Sym0 arg) (Mycompare_0123456789876543210Sym1 arg) =>
Mycompare_0123456789876543210Sym0KindInference
type instance Apply Mycompare_0123456789876543210Sym0 l = Mycompare_0123456789876543210Sym1 l
instance PMyOrd Nat where
type Mycompare a a = Apply (Apply Mycompare_0123456789876543210Sym0 a) a
type family Mycompare_0123456789876543210 (a :: ()) (a :: ()) :: Ordering where
Mycompare_0123456789876543210 _ a_0123456789876543210 = Apply (Apply ConstSym0 EQSym0) a_0123456789876543210
type Mycompare_0123456789876543210Sym2 (t :: ()) (t :: ()) =
Mycompare_0123456789876543210 t t
instance SuppressUnusedWarnings Mycompare_0123456789876543210Sym1 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Mycompare_0123456789876543210Sym1KindInference)
GHC.Tuple.())
data Mycompare_0123456789876543210Sym1 (l :: ()) (l :: TyFun () Ordering)
= forall arg. SameKind (Apply (Mycompare_0123456789876543210Sym1 l) arg) (Mycompare_0123456789876543210Sym2 l arg) =>
Mycompare_0123456789876543210Sym1KindInference
type instance Apply (Mycompare_0123456789876543210Sym1 l) l = Mycompare_0123456789876543210 l l
instance SuppressUnusedWarnings Mycompare_0123456789876543210Sym0 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Mycompare_0123456789876543210Sym0KindInference)
GHC.Tuple.())
data Mycompare_0123456789876543210Sym0 (l :: TyFun () (TyFun () Ordering
-> GHC.Types.Type))
= forall arg. SameKind (Apply Mycompare_0123456789876543210Sym0 arg) (Mycompare_0123456789876543210Sym1 arg) =>
Mycompare_0123456789876543210Sym0KindInference
type instance Apply Mycompare_0123456789876543210Sym0 l = Mycompare_0123456789876543210Sym1 l
instance PMyOrd () where
type Mycompare a a = Apply (Apply Mycompare_0123456789876543210Sym0 a) a
type family Mycompare_0123456789876543210 (a :: Foo) (a :: Foo) :: Ordering where
Mycompare_0123456789876543210 a_0123456789876543210 a_0123456789876543210 = Apply (Apply FooCompareSym0 a_0123456789876543210) a_0123456789876543210
type Mycompare_0123456789876543210Sym2 (t :: Foo) (t :: Foo) =
Mycompare_0123456789876543210 t t
instance SuppressUnusedWarnings Mycompare_0123456789876543210Sym1 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Mycompare_0123456789876543210Sym1KindInference)
GHC.Tuple.())
data Mycompare_0123456789876543210Sym1 (l :: Foo) (l :: TyFun Foo Ordering)
= forall arg. SameKind (Apply (Mycompare_0123456789876543210Sym1 l) arg) (Mycompare_0123456789876543210Sym2 l arg) =>
Mycompare_0123456789876543210Sym1KindInference
type instance Apply (Mycompare_0123456789876543210Sym1 l) l = Mycompare_0123456789876543210 l l
instance SuppressUnusedWarnings Mycompare_0123456789876543210Sym0 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Mycompare_0123456789876543210Sym0KindInference)
GHC.Tuple.())
data Mycompare_0123456789876543210Sym0 (l :: TyFun Foo (TyFun Foo Ordering
-> GHC.Types.Type))
= forall arg. SameKind (Apply Mycompare_0123456789876543210Sym0 arg) (Mycompare_0123456789876543210Sym1 arg) =>
Mycompare_0123456789876543210Sym0KindInference
type instance Apply Mycompare_0123456789876543210Sym0 l = Mycompare_0123456789876543210Sym1 l
instance PMyOrd Foo where
type Mycompare a a = Apply (Apply Mycompare_0123456789876543210Sym0 a) a
type family TFHelper_0123456789876543210 (a :: Foo2) (a :: Foo2) :: Bool where
TFHelper_0123456789876543210 F F = TrueSym0
TFHelper_0123456789876543210 G G = TrueSym0
TFHelper_0123456789876543210 F G = FalseSym0
TFHelper_0123456789876543210 G F = FalseSym0
type TFHelper_0123456789876543210Sym2 (t :: Foo2) (t :: Foo2) =
TFHelper_0123456789876543210 t t
instance SuppressUnusedWarnings TFHelper_0123456789876543210Sym1 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) TFHelper_0123456789876543210Sym1KindInference)
GHC.Tuple.())
data TFHelper_0123456789876543210Sym1 (l :: Foo2) (l :: TyFun Foo2 Bool)
= forall arg. SameKind (Apply (TFHelper_0123456789876543210Sym1 l) arg) (TFHelper_0123456789876543210Sym2 l arg) =>
TFHelper_0123456789876543210Sym1KindInference
type instance Apply (TFHelper_0123456789876543210Sym1 l) l = TFHelper_0123456789876543210 l l
instance SuppressUnusedWarnings TFHelper_0123456789876543210Sym0 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) TFHelper_0123456789876543210Sym0KindInference)
GHC.Tuple.())
data TFHelper_0123456789876543210Sym0 (l :: TyFun Foo2 (TyFun Foo2 Bool
-> GHC.Types.Type))
= forall arg. SameKind (Apply TFHelper_0123456789876543210Sym0 arg) (TFHelper_0123456789876543210Sym1 arg) =>
TFHelper_0123456789876543210Sym0KindInference
type instance Apply TFHelper_0123456789876543210Sym0 l = TFHelper_0123456789876543210Sym1 l
instance PEq Foo2 where
type (==) a a = Apply (Apply TFHelper_0123456789876543210Sym0 a) a
infix 4 %<=>
sFooCompare ::
forall (t :: Foo) (t :: Foo).
Sing t
-> Sing t -> Sing (Apply (Apply FooCompareSym0 t) t :: Ordering)
sConst ::
forall (t :: a) (t :: b).
Sing t -> Sing t -> Sing (Apply (Apply ConstSym0 t) t :: a)
sFooCompare SA SA = SEQ
sFooCompare SA SB = SLT
sFooCompare SB SB = SGT
sFooCompare SB SA = SEQ
sConst (sX :: Sing x) _ = sX
data instance Sing (z :: Foo)
where
SA :: Sing A
SB :: Sing B
type SFoo = (Sing :: Foo -> GHC.Types.Type)
instance SingKind Foo where
type Demote Foo = Foo
fromSing SA = A
fromSing SB = B
toSing A = SomeSing SA
toSing B = SomeSing SB
data instance Sing (z :: Foo2)
where
SF :: Sing F
SG :: Sing G
type SFoo2 = (Sing :: Foo2 -> GHC.Types.Type)
instance SingKind Foo2 where
type Demote Foo2 = Foo2
fromSing SF = F
fromSing SG = G
toSing F = SomeSing SF
toSing G = SomeSing SG
class SMyOrd a where
sMycompare ::
forall (t :: a) (t :: a).
Sing t
-> Sing t -> Sing (Apply (Apply MycompareSym0 t) t :: Ordering)
(%<=>) ::
forall (t :: a) (t :: a).
Sing t -> Sing t -> Sing (Apply (Apply (<=>@#@$) t) t :: Ordering)
default (%<=>) ::
forall (t :: a) (t :: a).
(Apply (Apply (<=>@#@$) t) t :: Ordering) ~ Apply (Apply TFHelper_0123456789876543210Sym0 t) t =>
Sing t -> Sing t -> Sing (Apply (Apply (<=>@#@$) t) t :: Ordering)
(%<=>)
(sA_0123456789876543210 :: Sing a_0123456789876543210)
(sA_0123456789876543210 :: Sing a_0123456789876543210)
= (applySing
((applySing ((singFun2 @MycompareSym0) sMycompare))
sA_0123456789876543210))
sA_0123456789876543210
instance SMyOrd Nat where
sMycompare ::
forall (t :: Nat) (t :: Nat).
Sing t
-> Sing t -> Sing (Apply (Apply MycompareSym0 t) t :: Ordering)
sMycompare SZero SZero = SEQ
sMycompare SZero (SSucc _) = SLT
sMycompare (SSucc _) SZero = SGT
sMycompare (SSucc (sN :: Sing n)) (SSucc (sM :: Sing m))
= (applySing
((applySing ((singFun2 @MycompareSym0) sMycompare)) sM))
sN
instance SMyOrd () where
sMycompare ::
forall (t :: ()) (t :: ()).
Sing t
-> Sing t -> Sing (Apply (Apply MycompareSym0 t) t :: Ordering)
sMycompare _ (sA_0123456789876543210 :: Sing a_0123456789876543210)
= (applySing ((applySing ((singFun2 @ConstSym0) sConst)) SEQ))
sA_0123456789876543210
instance SMyOrd Foo where
sMycompare ::
forall (t :: Foo) (t :: Foo).
Sing t
-> Sing t -> Sing (Apply (Apply MycompareSym0 t) t :: Ordering)
sMycompare
(sA_0123456789876543210 :: Sing a_0123456789876543210)
(sA_0123456789876543210 :: Sing a_0123456789876543210)
= (applySing
((applySing ((singFun2 @FooCompareSym0) sFooCompare))
sA_0123456789876543210))
sA_0123456789876543210
instance SEq Foo2 where
(%==) ::
forall (a :: Foo2) (b :: Foo2). Sing a -> Sing b -> Sing ((==) a b)
(%==) SF SF = STrue
(%==) SG SG = STrue
(%==) SF SG = SFalse
(%==) SG SF = SFalse
instance SingI A where
sing = SA
instance SingI B where
sing = SB
instance SingI F where
sing = SF
instance SingI G where
sing = SG
Singletons/Classes.hs:(0,0)-(0,0): Splicing declarations
promote
[d| instance Ord Foo2 where
F `compare` F = EQ
F `compare` _ = LT
_ `compare` _ = GT
instance MyOrd Foo2 where
F `mycompare` F = EQ
F `mycompare` _ = LT
_ `mycompare` _ = GT |]
======>
instance MyOrd Foo2 where
mycompare F F = EQ
mycompare F _ = LT
mycompare _ _ = GT
instance Ord Foo2 where
compare F F = EQ
compare F _ = LT
compare _ _ = GT
type family Mycompare_0123456789876543210 (a :: Foo2) (a :: Foo2) :: Ordering where
Mycompare_0123456789876543210 F F = EQSym0
Mycompare_0123456789876543210 F _ = LTSym0
Mycompare_0123456789876543210 _ _ = GTSym0
type Mycompare_0123456789876543210Sym2 (t :: Foo2) (t :: Foo2) =
Mycompare_0123456789876543210 t t
instance SuppressUnusedWarnings Mycompare_0123456789876543210Sym1 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Mycompare_0123456789876543210Sym1KindInference)
GHC.Tuple.())
data Mycompare_0123456789876543210Sym1 (l :: Foo2) (l :: TyFun Foo2 Ordering)
= forall arg. SameKind (Apply (Mycompare_0123456789876543210Sym1 l) arg) (Mycompare_0123456789876543210Sym2 l arg) =>
Mycompare_0123456789876543210Sym1KindInference
type instance Apply (Mycompare_0123456789876543210Sym1 l) l = Mycompare_0123456789876543210 l l
instance SuppressUnusedWarnings Mycompare_0123456789876543210Sym0 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Mycompare_0123456789876543210Sym0KindInference)
GHC.Tuple.())
data Mycompare_0123456789876543210Sym0 (l :: TyFun Foo2 (TyFun Foo2 Ordering
-> GHC.Types.Type))
= forall arg. SameKind (Apply Mycompare_0123456789876543210Sym0 arg) (Mycompare_0123456789876543210Sym1 arg) =>
Mycompare_0123456789876543210Sym0KindInference
type instance Apply Mycompare_0123456789876543210Sym0 l = Mycompare_0123456789876543210Sym1 l
instance PMyOrd Foo2 where
type Mycompare a a = Apply (Apply Mycompare_0123456789876543210Sym0 a) a
type family Compare_0123456789876543210 (a :: Foo2) (a :: Foo2) :: Ordering where
Compare_0123456789876543210 F F = EQSym0
Compare_0123456789876543210 F _ = LTSym0
Compare_0123456789876543210 _ _ = GTSym0
type Compare_0123456789876543210Sym2 (t :: Foo2) (t :: Foo2) =
Compare_0123456789876543210 t t
instance SuppressUnusedWarnings Compare_0123456789876543210Sym1 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Compare_0123456789876543210Sym1KindInference)
GHC.Tuple.())
data Compare_0123456789876543210Sym1 (l :: Foo2) (l :: TyFun Foo2 Ordering)
= forall arg. SameKind (Apply (Compare_0123456789876543210Sym1 l) arg) (Compare_0123456789876543210Sym2 l arg) =>
Compare_0123456789876543210Sym1KindInference
type instance Apply (Compare_0123456789876543210Sym1 l) l = Compare_0123456789876543210 l l
instance SuppressUnusedWarnings Compare_0123456789876543210Sym0 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Compare_0123456789876543210Sym0KindInference)
GHC.Tuple.())
data Compare_0123456789876543210Sym0 (l :: TyFun Foo2 (TyFun Foo2 Ordering
-> GHC.Types.Type))
= forall arg. SameKind (Apply Compare_0123456789876543210Sym0 arg) (Compare_0123456789876543210Sym1 arg) =>
Compare_0123456789876543210Sym0KindInference
type instance Apply Compare_0123456789876543210Sym0 l = Compare_0123456789876543210Sym1 l
instance POrd Foo2 where
type Compare a a = Apply (Apply Compare_0123456789876543210Sym0 a) a
Singletons/Classes.hs:(0,0)-(0,0): Splicing declarations
singletons
[d| data Nat' = Zero' | Succ' Nat'
instance MyOrd Nat' where
Zero' `mycompare` Zero' = EQ
Zero' `mycompare` (Succ' _) = LT
(Succ' _) `mycompare` Zero' = GT
(Succ' n) `mycompare` (Succ' m) = m `mycompare` n |]
======>
data Nat' = Zero' | Succ' Nat'
instance MyOrd Nat' where
mycompare Zero' Zero' = EQ
mycompare Zero' (Succ' _) = LT
mycompare (Succ' _) Zero' = GT
mycompare (Succ' n) (Succ' m) = (m `mycompare` n)
type Zero'Sym0 = Zero'
type Succ'Sym1 (t :: Nat') = Succ' t
instance SuppressUnusedWarnings Succ'Sym0 where
suppressUnusedWarnings
= snd ((GHC.Tuple.(,) Succ'Sym0KindInference) GHC.Tuple.())
data Succ'Sym0 (l :: TyFun Nat' Nat')
= forall arg. SameKind (Apply Succ'Sym0 arg) (Succ'Sym1 arg) =>
Succ'Sym0KindInference
type instance Apply Succ'Sym0 l = Succ' l
type family Mycompare_0123456789876543210 (a :: Nat') (a :: Nat') :: Ordering where
Mycompare_0123456789876543210 Zero' Zero' = EQSym0
Mycompare_0123456789876543210 Zero' (Succ' _) = LTSym0
Mycompare_0123456789876543210 (Succ' _) Zero' = GTSym0
Mycompare_0123456789876543210 (Succ' n) (Succ' m) = Apply (Apply MycompareSym0 m) n
type Mycompare_0123456789876543210Sym2 (t :: Nat') (t :: Nat') =
Mycompare_0123456789876543210 t t
instance SuppressUnusedWarnings Mycompare_0123456789876543210Sym1 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Mycompare_0123456789876543210Sym1KindInference)
GHC.Tuple.())
data Mycompare_0123456789876543210Sym1 (l :: Nat') (l :: TyFun Nat' Ordering)
= forall arg. SameKind (Apply (Mycompare_0123456789876543210Sym1 l) arg) (Mycompare_0123456789876543210Sym2 l arg) =>
Mycompare_0123456789876543210Sym1KindInference
type instance Apply (Mycompare_0123456789876543210Sym1 l) l = Mycompare_0123456789876543210 l l
instance SuppressUnusedWarnings Mycompare_0123456789876543210Sym0 where
suppressUnusedWarnings
= snd
((GHC.Tuple.(,) Mycompare_0123456789876543210Sym0KindInference)
GHC.Tuple.())
data Mycompare_0123456789876543210Sym0 (l :: TyFun Nat' (TyFun Nat' Ordering
-> GHC.Types.Type))
= forall arg. SameKind (Apply Mycompare_0123456789876543210Sym0 arg) (Mycompare_0123456789876543210Sym1 arg) =>
Mycompare_0123456789876543210Sym0KindInference
type instance Apply Mycompare_0123456789876543210Sym0 l = Mycompare_0123456789876543210Sym1 l
instance PMyOrd Nat' where
type Mycompare a a = Apply (Apply Mycompare_0123456789876543210Sym0 a) a
data instance Sing (z :: Nat')
where
SZero' :: Sing Zero'
SSucc' :: forall (n :: Nat'). (Sing (n :: Nat')) -> Sing (Succ' n)
type SNat' = (Sing :: Nat' -> GHC.Types.Type)
instance SingKind Nat' where
type Demote Nat' = Nat'
fromSing SZero' = Zero'
fromSing (SSucc' b) = Succ' (fromSing b)
toSing Zero' = SomeSing SZero'
toSing (Succ' (b :: Demote Nat'))
= case toSing b :: SomeSing Nat' of {
SomeSing c -> SomeSing (SSucc' c) }
instance SMyOrd Nat' where
sMycompare ::
forall (t :: Nat') (t :: Nat').
Sing t
-> Sing t
-> Sing (Apply (Apply (MycompareSym0 :: TyFun Nat' (TyFun Nat' Ordering
-> GHC.Types.Type)
-> GHC.Types.Type) t) t)
sMycompare SZero' SZero' = SEQ
sMycompare SZero' (SSucc' _) = SLT
sMycompare (SSucc' _) SZero' = SGT
sMycompare (SSucc' (sN :: Sing n)) (SSucc' (sM :: Sing m))
= (applySing
((applySing ((singFun2 @MycompareSym0) sMycompare)) sM))
sN
instance SingI Zero' where
sing = SZero'
instance SingI n => SingI (Succ' (n :: Nat')) where
sing = SSucc' sing