singletons-base-3.5: tests/compile-and-dump/Singletons/StandaloneDeriving.golden
Singletons/StandaloneDeriving.hs:(0,0)-(0,0): Splicing declarations
singletons
[d| infixl 6 :*:
data T a b = a :*: b
data S = S1 | S2
deriving instance Enum S
deriving instance Bounded S
deriving instance Show S
deriving instance Ord S
deriving instance Eq S
deriving instance Show a => Show (T a ())
deriving instance Ord a => Ord (T a ())
deriving instance Eq a => Eq (T a ()) |]
======>
infixl 6 :*:
data T a b = a :*: b
data S = S1 | S2
deriving instance Eq a => Eq (T a ())
deriving instance Ord a => Ord (T a ())
deriving instance Show a => Show (T a ())
deriving instance Eq S
deriving instance Ord S
deriving instance Show S
deriving instance Bounded S
deriving instance Enum S
type (:*:@#@$) :: forall a b. (~>) a ((~>) b (T a b))
data (:*:@#@$) :: (~>) a ((~>) b (T a b))
where
(::*:@#@$###) :: SameKind (Apply (:*:@#@$) arg) ((:*:@#@$$) arg) =>
(:*:@#@$) a0123456789876543210
type instance Apply @a @((~>) b (T a b)) (:*:@#@$) a0123456789876543210 = (:*:@#@$$) a0123456789876543210
instance SuppressUnusedWarnings (:*:@#@$) where
suppressUnusedWarnings = snd ((,) (::*:@#@$###) ())
infixl 6 type :*:@#@$
type (:*:@#@$$) :: forall a b. a -> (~>) b (T a b)
data (:*:@#@$$) (a0123456789876543210 :: a) :: (~>) b (T a b)
where
(::*:@#@$$###) :: SameKind (Apply ((:*:@#@$$) a0123456789876543210) arg) ((:*:@#@$$$) a0123456789876543210 arg) =>
(:*:@#@$$) a0123456789876543210 a0123456789876543210
type instance Apply @b @(T a b) ((:*:@#@$$) a0123456789876543210) a0123456789876543210 = (:*:) a0123456789876543210 a0123456789876543210
instance SuppressUnusedWarnings ((:*:@#@$$) a0123456789876543210) where
suppressUnusedWarnings = snd ((,) (::*:@#@$$###) ())
infixl 6 type :*:@#@$$
type (:*:@#@$$$) :: forall a b. a -> b -> T a b
type family (:*:@#@$$$) @a @b (a0123456789876543210 :: a) (a0123456789876543210 :: b) :: T a b where
(:*:@#@$$$) a0123456789876543210 a0123456789876543210 = (:*:) a0123456789876543210 a0123456789876543210
infixl 6 type :*:@#@$$$
type S1Sym0 :: S
type family S1Sym0 :: S where
S1Sym0 = S1
type S2Sym0 :: S
type family S2Sym0 :: S where
S2Sym0 = S2
type TFHelper_0123456789876543210 :: forall a. T a ()
-> T a () -> Bool
type family TFHelper_0123456789876543210 @a (a :: T a ()) (a :: T a ()) :: Bool where
TFHelper_0123456789876543210 @a ((:*:) a_0123456789876543210 a_0123456789876543210 :: T a ()) ((:*:) b_0123456789876543210 b_0123456789876543210 :: T a ()) = Apply (Apply (&&@#@$) (Apply (Apply (==@#@$) a_0123456789876543210) b_0123456789876543210)) (Apply (Apply (==@#@$) a_0123456789876543210) b_0123456789876543210)
instance PEq (T a ()) where
type (==) a a = TFHelper_0123456789876543210 a a
type Compare_0123456789876543210 :: forall a. T a ()
-> T a () -> Ordering
type family Compare_0123456789876543210 @a (a :: T a ()) (a :: T a ()) :: Ordering where
Compare_0123456789876543210 @a ((:*:) a_0123456789876543210 a_0123456789876543210 :: T a ()) ((:*:) b_0123456789876543210 b_0123456789876543210 :: T a ()) = Apply (Apply (Apply FoldlSym0 (<>@#@$)) EQSym0) (Apply (Apply (:@#@$) (Apply (Apply CompareSym0 a_0123456789876543210) b_0123456789876543210)) (Apply (Apply (:@#@$) (Apply (Apply CompareSym0 a_0123456789876543210) b_0123456789876543210)) NilSym0))
instance POrd (T a ()) where
type Compare a a = Compare_0123456789876543210 a a
type ShowsPrec_0123456789876543210 :: forall a. GHC.Num.Natural.Natural
-> T a () -> Symbol -> Symbol
type family ShowsPrec_0123456789876543210 @a (a :: GHC.Num.Natural.Natural) (a :: T a ()) (a :: Symbol) :: Symbol where
ShowsPrec_0123456789876543210 @a (p_0123456789876543210 :: GHC.Num.Natural.Natural) ((:*:) argL_0123456789876543210 argR_0123456789876543210 :: T a ()) (a_0123456789876543210 :: Symbol) = Apply (Apply (Apply ShowParenSym0 (Apply (Apply (>@#@$) p_0123456789876543210) (FromInteger 6))) (Apply (Apply (.@#@$) (Apply (Apply ShowsPrecSym0 (FromInteger 7)) argL_0123456789876543210)) (Apply (Apply (.@#@$) (Apply ShowStringSym0 " :*: ")) (Apply (Apply ShowsPrecSym0 (FromInteger 7)) argR_0123456789876543210)))) a_0123456789876543210
instance PShow (T a ()) where
type ShowsPrec a a a = ShowsPrec_0123456789876543210 a a a
type TFHelper_0123456789876543210 :: S -> S -> Bool
type family TFHelper_0123456789876543210 (a :: S) (a :: S) :: Bool where
TFHelper_0123456789876543210 S1 S1 = TrueSym0
TFHelper_0123456789876543210 S1 S2 = FalseSym0
TFHelper_0123456789876543210 S2 S1 = FalseSym0
TFHelper_0123456789876543210 S2 S2 = TrueSym0
instance PEq S where
type (==) a a = TFHelper_0123456789876543210 a a
type Compare_0123456789876543210 :: S -> S -> Ordering
type family Compare_0123456789876543210 (a :: S) (a :: S) :: Ordering where
Compare_0123456789876543210 S1 S1 = Apply (Apply (Apply FoldlSym0 (<>@#@$)) EQSym0) NilSym0
Compare_0123456789876543210 S2 S2 = Apply (Apply (Apply FoldlSym0 (<>@#@$)) EQSym0) NilSym0
Compare_0123456789876543210 S1 S2 = LTSym0
Compare_0123456789876543210 S2 S1 = GTSym0
instance POrd S where
type Compare a a = Compare_0123456789876543210 a a
type ShowsPrec_0123456789876543210 :: GHC.Num.Natural.Natural
-> S -> Symbol -> Symbol
type family ShowsPrec_0123456789876543210 (a :: GHC.Num.Natural.Natural) (a :: S) (a :: Symbol) :: Symbol where
ShowsPrec_0123456789876543210 _ S1 a_0123456789876543210 = Apply (Apply ShowStringSym0 "S1") a_0123456789876543210
ShowsPrec_0123456789876543210 _ S2 a_0123456789876543210 = Apply (Apply ShowStringSym0 "S2") a_0123456789876543210
instance PShow S where
type ShowsPrec a a a = ShowsPrec_0123456789876543210 a a a
type MinBound_0123456789876543210 :: S
type family MinBound_0123456789876543210 :: S where
MinBound_0123456789876543210 = S1Sym0
type MaxBound_0123456789876543210 :: S
type family MaxBound_0123456789876543210 :: S where
MaxBound_0123456789876543210 = S2Sym0
instance PBounded S where
type MinBound = MinBound_0123456789876543210
type MaxBound = MaxBound_0123456789876543210
type family LamCases_0123456789876543210 (n0123456789876543210 :: GHC.Num.Natural.Natural) a_0123456789876543210 where
LamCases_0123456789876543210 n 'True = S2Sym0
LamCases_0123456789876543210 n 'False = Apply ErrorSym0 "toEnum: bad argument"
data LamCases_0123456789876543210Sym0 (n0123456789876543210 :: GHC.Num.Natural.Natural) a_01234567898765432100123456789876543210
where
LamCases_0123456789876543210Sym0KindInference :: SameKind (Apply (LamCases_0123456789876543210Sym0 n0123456789876543210) arg) (LamCases_0123456789876543210Sym1 n0123456789876543210 arg) =>
LamCases_0123456789876543210Sym0 n0123456789876543210 a_01234567898765432100123456789876543210
type instance Apply @_ @_ (LamCases_0123456789876543210Sym0 n0123456789876543210) a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 n0123456789876543210 a_01234567898765432100123456789876543210
instance SuppressUnusedWarnings (LamCases_0123456789876543210Sym0 n0123456789876543210) where
suppressUnusedWarnings
= snd ((,) LamCases_0123456789876543210Sym0KindInference ())
type family LamCases_0123456789876543210Sym1 (n0123456789876543210 :: GHC.Num.Natural.Natural) a_01234567898765432100123456789876543210 where
LamCases_0123456789876543210Sym1 n0123456789876543210 a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 n0123456789876543210 a_01234567898765432100123456789876543210
type family LamCases_0123456789876543210 (n0123456789876543210 :: GHC.Num.Natural.Natural) a_0123456789876543210 where
LamCases_0123456789876543210 n 'True = S1Sym0
LamCases_0123456789876543210 n 'False = Apply (LamCases_0123456789876543210Sym0 n) (Apply (Apply (==@#@$) n) (FromInteger 1))
data LamCases_0123456789876543210Sym0 (n0123456789876543210 :: GHC.Num.Natural.Natural) a_01234567898765432100123456789876543210
where
LamCases_0123456789876543210Sym0KindInference :: SameKind (Apply (LamCases_0123456789876543210Sym0 n0123456789876543210) arg) (LamCases_0123456789876543210Sym1 n0123456789876543210 arg) =>
LamCases_0123456789876543210Sym0 n0123456789876543210 a_01234567898765432100123456789876543210
type instance Apply @_ @_ (LamCases_0123456789876543210Sym0 n0123456789876543210) a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 n0123456789876543210 a_01234567898765432100123456789876543210
instance SuppressUnusedWarnings (LamCases_0123456789876543210Sym0 n0123456789876543210) where
suppressUnusedWarnings
= snd ((,) LamCases_0123456789876543210Sym0KindInference ())
type family LamCases_0123456789876543210Sym1 (n0123456789876543210 :: GHC.Num.Natural.Natural) a_01234567898765432100123456789876543210 where
LamCases_0123456789876543210Sym1 n0123456789876543210 a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 n0123456789876543210 a_01234567898765432100123456789876543210
type ToEnum_0123456789876543210 :: GHC.Num.Natural.Natural -> S
type family ToEnum_0123456789876543210 (a :: GHC.Num.Natural.Natural) :: S where
ToEnum_0123456789876543210 n = Apply (LamCases_0123456789876543210Sym0 n) (Apply (Apply (==@#@$) n) (FromInteger 0))
type FromEnum_0123456789876543210 :: S -> GHC.Num.Natural.Natural
type family FromEnum_0123456789876543210 (a :: S) :: GHC.Num.Natural.Natural where
FromEnum_0123456789876543210 S1 = FromInteger 0
FromEnum_0123456789876543210 S2 = FromInteger 1
instance PEnum S where
type ToEnum a = ToEnum_0123456789876543210 a
type FromEnum a = FromEnum_0123456789876543210 a
infixl 6 data :%*:
data ST :: forall a b. T a b -> Type
where
(:%*:) :: forall a b (n :: a) (n :: b).
(Sing n) -> (Sing n) -> ST ((:*:) n n :: T a b)
type instance Sing @(T a b) = ST
instance (SingKind a, SingKind b) => SingKind (T a b) where
type Demote (T a b) = T (Demote a) (Demote b)
fromSing ((:%*:) b b) = (:*:) (fromSing b) (fromSing b)
toSing ((:*:) (b :: Demote a) (b :: Demote b))
= (\cases (SomeSing c) (SomeSing c) -> SomeSing ((:%*:) c c))
(toSing b :: SomeSing a) (toSing b :: SomeSing b)
data SS :: S -> Type
where
SS1 :: SS (S1 :: S)
SS2 :: SS (S2 :: S)
type instance Sing @S = SS
instance SingKind S where
type Demote S = S
fromSing SS1 = S1
fromSing SS2 = S2
toSing S1 = SomeSing SS1
toSing S2 = SomeSing SS2
instance SEq a => SEq (T a ()) where
(%==)
((:%*:) (sA_0123456789876543210 :: Sing a_0123456789876543210)
(sA_0123456789876543210 :: Sing a_0123456789876543210))
((:%*:) (sB_0123456789876543210 :: Sing b_0123456789876543210)
(sB_0123456789876543210 :: Sing b_0123456789876543210))
= applySing
(applySing
(singFun2 @(&&@#@$) (%&&))
(applySing
(applySing (singFun2 @(==@#@$) (%==)) sA_0123456789876543210)
sB_0123456789876543210))
(applySing
(applySing (singFun2 @(==@#@$) (%==)) sA_0123456789876543210)
sB_0123456789876543210)
instance SOrd a => SOrd (T a ()) where
sCompare
((:%*:) (sA_0123456789876543210 :: Sing a_0123456789876543210)
(sA_0123456789876543210 :: Sing a_0123456789876543210))
((:%*:) (sB_0123456789876543210 :: Sing b_0123456789876543210)
(sB_0123456789876543210 :: Sing b_0123456789876543210))
= applySing
(applySing
(applySing (singFun3 @FoldlSym0 sFoldl) (singFun2 @(<>@#@$) (%<>)))
SEQ)
(applySing
(applySing
(singFun2 @(:@#@$) SCons)
(applySing
(applySing (singFun2 @CompareSym0 sCompare) sA_0123456789876543210)
sB_0123456789876543210))
(applySing
(applySing
(singFun2 @(:@#@$) SCons)
(applySing
(applySing (singFun2 @CompareSym0 sCompare) sA_0123456789876543210)
sB_0123456789876543210))
SNil))
instance SShow a => SShow (T a ()) where
sShowsPrec
(sP_0123456789876543210 :: Sing p_0123456789876543210)
((:%*:) (sArgL_0123456789876543210 :: Sing argL_0123456789876543210)
(sArgR_0123456789876543210 :: Sing argR_0123456789876543210))
(sA_0123456789876543210 :: Sing a_0123456789876543210)
= applySing
(applySing
(applySing
(singFun3 @ShowParenSym0 sShowParen)
(applySing
(applySing (singFun2 @(>@#@$) (%>)) sP_0123456789876543210)
(sFromInteger (sing :: Sing 6))))
(applySing
(applySing
(singFun3 @(.@#@$) (%.))
(applySing
(applySing
(singFun3 @ShowsPrecSym0 sShowsPrec)
(sFromInteger (sing :: Sing 7)))
sArgL_0123456789876543210))
(applySing
(applySing
(singFun3 @(.@#@$) (%.))
(applySing
(singFun2 @ShowStringSym0 sShowString) (sing :: Sing " :*: ")))
(applySing
(applySing
(singFun3 @ShowsPrecSym0 sShowsPrec)
(sFromInteger (sing :: Sing 7)))
sArgR_0123456789876543210))))
sA_0123456789876543210
instance SEq S where
(%==) SS1 SS1 = STrue
(%==) SS1 SS2 = SFalse
(%==) SS2 SS1 = SFalse
(%==) SS2 SS2 = STrue
instance SOrd S where
sCompare SS1 SS1
= applySing
(applySing
(applySing (singFun3 @FoldlSym0 sFoldl) (singFun2 @(<>@#@$) (%<>)))
SEQ)
SNil
sCompare SS2 SS2
= applySing
(applySing
(applySing (singFun3 @FoldlSym0 sFoldl) (singFun2 @(<>@#@$) (%<>)))
SEQ)
SNil
sCompare SS1 SS2 = SLT
sCompare SS2 SS1 = SGT
instance SShow S where
sShowsPrec
_
SS1
(sA_0123456789876543210 :: Sing a_0123456789876543210)
= applySing
(applySing
(singFun2 @ShowStringSym0 sShowString) (sing :: Sing "S1"))
sA_0123456789876543210
sShowsPrec
_
SS2
(sA_0123456789876543210 :: Sing a_0123456789876543210)
= applySing
(applySing
(singFun2 @ShowStringSym0 sShowString) (sing :: Sing "S2"))
sA_0123456789876543210
instance SBounded S where
sMinBound = SS1
sMaxBound = SS2
instance SEnum S where
sToEnum (sN :: Sing n)
= applySing
(singFun1
@(LamCases_0123456789876543210Sym0 n)
(\cases
STrue -> SS1
SFalse
-> applySing
(singFun1
@(LamCases_0123456789876543210Sym0 n)
(\cases
STrue -> SS2
SFalse
-> applySing
(singFun1 @ErrorSym0 sError)
(sing :: Sing "toEnum: bad argument")))
(applySing
(applySing (singFun2 @(==@#@$) (%==)) sN)
(sFromInteger (sing :: Sing 1)))))
(applySing
(applySing (singFun2 @(==@#@$) (%==)) sN)
(sFromInteger (sing :: Sing 0)))
sFromEnum SS1 = sFromInteger (sing :: Sing 0)
sFromEnum SS2 = sFromInteger (sing :: Sing 1)
instance SDecide a => SDecide (T a ()) where
(%~) ((:%*:) a a) ((:%*:) b b)
= (\cases
(Proved Refl) (Proved Refl) -> Proved Refl
(Disproved contra) _ -> Disproved (\cases Refl -> contra Refl)
_ (Disproved contra) -> Disproved (\cases Refl -> contra Refl))
((%~) a b) ((%~) a b)
instance Eq (ST (z :: T a ())) where
(==) _ _ = True
instance SDecide a =>
GHC.Internal.Data.Type.Equality.TestEquality (ST :: T a ()
-> Type) where
GHC.Internal.Data.Type.Equality.testEquality
= Data.Singletons.Decide.decideEquality
instance SDecide a =>
GHC.Internal.Data.Type.Coercion.TestCoercion (ST :: T a ()
-> Type) where
GHC.Internal.Data.Type.Coercion.testCoercion
= Data.Singletons.Decide.decideCoercion
instance SDecide S where
(%~) SS1 SS1 = Proved Refl
(%~) SS1 SS2 = Disproved (\case)
(%~) SS2 SS1 = Disproved (\case)
(%~) SS2 SS2 = Proved Refl
instance Eq (SS (z :: S)) where
(==) _ _ = True
instance GHC.Internal.Data.Type.Equality.TestEquality (SS :: S
-> Type) where
GHC.Internal.Data.Type.Equality.testEquality
= Data.Singletons.Decide.decideEquality
instance GHC.Internal.Data.Type.Coercion.TestCoercion (SS :: S
-> Type) where
GHC.Internal.Data.Type.Coercion.testCoercion
= Data.Singletons.Decide.decideCoercion
instance Ord (ST (z :: T a ())) where
compare _ _ = EQ
instance Ord (SS (z :: S)) where
compare _ _ = EQ
deriving instance Data.Singletons.ShowSing.ShowSing a =>
Show (ST (z :: T a ()))
deriving instance Show (SS (z :: S))
instance (SingI n, SingI n) =>
SingI ((:*:) (n :: a) (n :: b)) where
sing = (:%*:) sing sing
instance SingI n => SingI1 ((:*:) (n :: a)) where
liftSing = (:%*:) sing
instance SingI2 (:*:) where
liftSing2 = (:%*:)
instance SingI ((:*:@#@$) :: (~>) a ((~>) b (T a b))) where
sing = singFun2 @(:*:@#@$) (:%*:)
instance SingI d =>
SingI ((:*:@#@$$) (d :: a) :: (~>) b (T a b)) where
sing = singFun1 @((:*:@#@$$) (d :: a)) ((:%*:) (sing @d))
instance SingI1 ((:*:@#@$$) :: a -> (~>) b (T a b)) where
liftSing (s :: Sing (d :: a))
= singFun1 @((:*:@#@$$) (d :: a)) ((:%*:) s)
instance SingI S1 where
sing = SS1
instance SingI S2 where
sing = SS2