Singletons/BoundedDeriving.hs:(0,0)-(0,0): Splicing declarations singletons [d| data Foo1 = Foo1 deriving (Bounded) data Foo2 = A | B | C | D | E deriving (Bounded) data Foo3 a = Foo3 a deriving (Bounded) data Foo4 (a :: Type) (b :: Type) = Foo41 | Foo42 deriving Bounded data Pair = Pair Bool Bool deriving Bounded |] ======> data Foo1 = Foo1 deriving Bounded data Foo2 = A | B | C | D | E deriving Bounded data Foo3 a = Foo3 a deriving Bounded data Foo4 (a :: Type) (b :: Type) = Foo41 | Foo42 deriving Bounded data Pair = Pair Bool Bool deriving Bounded type Foo1Sym0 :: Foo1 type family Foo1Sym0 :: Foo1 where Foo1Sym0 = Foo1 type ASym0 :: Foo2 type family ASym0 :: Foo2 where ASym0 = A type BSym0 :: Foo2 type family BSym0 :: Foo2 where BSym0 = B type CSym0 :: Foo2 type family CSym0 :: Foo2 where CSym0 = C type DSym0 :: Foo2 type family DSym0 :: Foo2 where DSym0 = D type ESym0 :: Foo2 type family ESym0 :: Foo2 where ESym0 = E type Foo3Sym0 :: forall a. (~>) a (Foo3 a) data Foo3Sym0 :: (~>) a (Foo3 a) where Foo3Sym0KindInference :: SameKind (Apply Foo3Sym0 arg) (Foo3Sym1 arg) => Foo3Sym0 a0123456789876543210 type instance Apply Foo3Sym0 a0123456789876543210 = Foo3 a0123456789876543210 instance SuppressUnusedWarnings Foo3Sym0 where suppressUnusedWarnings = snd ((,) Foo3Sym0KindInference ()) type Foo3Sym1 :: forall a. a -> Foo3 a type family Foo3Sym1 (a0123456789876543210 :: a) :: Foo3 a where Foo3Sym1 a0123456789876543210 = Foo3 a0123456789876543210 type Foo41Sym0 :: forall (a :: Type) (b :: Type). Foo4 (a :: Type) (b :: Type) type family Foo41Sym0 :: Foo4 (a :: Type) (b :: Type) where Foo41Sym0 = Foo41 type Foo42Sym0 :: forall (a :: Type) (b :: Type). Foo4 (a :: Type) (b :: Type) type family Foo42Sym0 :: Foo4 (a :: Type) (b :: Type) where Foo42Sym0 = Foo42 type PairSym0 :: (~>) Bool ((~>) Bool Pair) data PairSym0 :: (~>) Bool ((~>) Bool Pair) where PairSym0KindInference :: SameKind (Apply PairSym0 arg) (PairSym1 arg) => PairSym0 a0123456789876543210 type instance Apply PairSym0 a0123456789876543210 = PairSym1 a0123456789876543210 instance SuppressUnusedWarnings PairSym0 where suppressUnusedWarnings = snd ((,) PairSym0KindInference ()) type PairSym1 :: Bool -> (~>) Bool Pair data PairSym1 (a0123456789876543210 :: Bool) :: (~>) Bool Pair where PairSym1KindInference :: SameKind (Apply (PairSym1 a0123456789876543210) arg) (PairSym2 a0123456789876543210 arg) => PairSym1 a0123456789876543210 a0123456789876543210 type instance Apply (PairSym1 a0123456789876543210) a0123456789876543210 = Pair a0123456789876543210 a0123456789876543210 instance SuppressUnusedWarnings (PairSym1 a0123456789876543210) where suppressUnusedWarnings = snd ((,) PairSym1KindInference ()) type PairSym2 :: Bool -> Bool -> Pair type family PairSym2 (a0123456789876543210 :: Bool) (a0123456789876543210 :: Bool) :: Pair where PairSym2 a0123456789876543210 a0123456789876543210 = Pair a0123456789876543210 a0123456789876543210 type MinBound_0123456789876543210 :: Foo1 type family MinBound_0123456789876543210 :: Foo1 where MinBound_0123456789876543210 = Foo1Sym0 type MinBound_0123456789876543210Sym0 :: Foo1 type family MinBound_0123456789876543210Sym0 :: Foo1 where MinBound_0123456789876543210Sym0 = MinBound_0123456789876543210 type MaxBound_0123456789876543210 :: Foo1 type family MaxBound_0123456789876543210 :: Foo1 where MaxBound_0123456789876543210 = Foo1Sym0 type MaxBound_0123456789876543210Sym0 :: Foo1 type family MaxBound_0123456789876543210Sym0 :: Foo1 where MaxBound_0123456789876543210Sym0 = MaxBound_0123456789876543210 instance PBounded Foo1 where type MinBound = MinBound_0123456789876543210Sym0 type MaxBound = MaxBound_0123456789876543210Sym0 type MinBound_0123456789876543210 :: Foo2 type family MinBound_0123456789876543210 :: Foo2 where MinBound_0123456789876543210 = ASym0 type MinBound_0123456789876543210Sym0 :: Foo2 type family MinBound_0123456789876543210Sym0 :: Foo2 where MinBound_0123456789876543210Sym0 = MinBound_0123456789876543210 type MaxBound_0123456789876543210 :: Foo2 type family MaxBound_0123456789876543210 :: Foo2 where MaxBound_0123456789876543210 = ESym0 type MaxBound_0123456789876543210Sym0 :: Foo2 type family MaxBound_0123456789876543210Sym0 :: Foo2 where MaxBound_0123456789876543210Sym0 = MaxBound_0123456789876543210 instance PBounded Foo2 where type MinBound = MinBound_0123456789876543210Sym0 type MaxBound = MaxBound_0123456789876543210Sym0 type MinBound_0123456789876543210 :: Foo3 a type family MinBound_0123456789876543210 :: Foo3 a where MinBound_0123456789876543210 = Apply Foo3Sym0 MinBoundSym0 type MinBound_0123456789876543210Sym0 :: Foo3 a type family MinBound_0123456789876543210Sym0 :: Foo3 a where MinBound_0123456789876543210Sym0 = MinBound_0123456789876543210 type MaxBound_0123456789876543210 :: Foo3 a type family MaxBound_0123456789876543210 :: Foo3 a where MaxBound_0123456789876543210 = Apply Foo3Sym0 MaxBoundSym0 type MaxBound_0123456789876543210Sym0 :: Foo3 a type family MaxBound_0123456789876543210Sym0 :: Foo3 a where MaxBound_0123456789876543210Sym0 = MaxBound_0123456789876543210 instance PBounded (Foo3 a) where type MinBound = MinBound_0123456789876543210Sym0 type MaxBound = MaxBound_0123456789876543210Sym0 type MinBound_0123456789876543210 :: Foo4 a b type family MinBound_0123456789876543210 :: Foo4 a b where MinBound_0123456789876543210 = Foo41Sym0 type MinBound_0123456789876543210Sym0 :: Foo4 a b type family MinBound_0123456789876543210Sym0 :: Foo4 a b where MinBound_0123456789876543210Sym0 = MinBound_0123456789876543210 type MaxBound_0123456789876543210 :: Foo4 a b type family MaxBound_0123456789876543210 :: Foo4 a b where MaxBound_0123456789876543210 = Foo42Sym0 type MaxBound_0123456789876543210Sym0 :: Foo4 a b type family MaxBound_0123456789876543210Sym0 :: Foo4 a b where MaxBound_0123456789876543210Sym0 = MaxBound_0123456789876543210 instance PBounded (Foo4 a b) where type MinBound = MinBound_0123456789876543210Sym0 type MaxBound = MaxBound_0123456789876543210Sym0 type MinBound_0123456789876543210 :: Pair type family MinBound_0123456789876543210 :: Pair where MinBound_0123456789876543210 = Apply (Apply PairSym0 MinBoundSym0) MinBoundSym0 type MinBound_0123456789876543210Sym0 :: Pair type family MinBound_0123456789876543210Sym0 :: Pair where MinBound_0123456789876543210Sym0 = MinBound_0123456789876543210 type MaxBound_0123456789876543210 :: Pair type family MaxBound_0123456789876543210 :: Pair where MaxBound_0123456789876543210 = Apply (Apply PairSym0 MaxBoundSym0) MaxBoundSym0 type MaxBound_0123456789876543210Sym0 :: Pair type family MaxBound_0123456789876543210Sym0 :: Pair where MaxBound_0123456789876543210Sym0 = MaxBound_0123456789876543210 instance PBounded Pair where type MinBound = MinBound_0123456789876543210Sym0 type MaxBound = MaxBound_0123456789876543210Sym0 data SFoo1 :: Foo1 -> Type where SFoo1 :: SFoo1 (Foo1 :: Foo1) type instance Sing @Foo1 = SFoo1 instance SingKind Foo1 where type Demote Foo1 = Foo1 fromSing SFoo1 = Foo1 toSing Foo1 = SomeSing SFoo1 data SFoo2 :: Foo2 -> Type where SA :: SFoo2 (A :: Foo2) SB :: SFoo2 (B :: Foo2) SC :: SFoo2 (C :: Foo2) SD :: SFoo2 (D :: Foo2) SE :: SFoo2 (E :: Foo2) type instance Sing @Foo2 = SFoo2 instance SingKind Foo2 where type Demote Foo2 = Foo2 fromSing SA = A fromSing SB = B fromSing SC = C fromSing SD = D fromSing SE = E toSing A = SomeSing SA toSing B = SomeSing SB toSing C = SomeSing SC toSing D = SomeSing SD toSing E = SomeSing SE data SFoo3 :: forall a. Foo3 a -> Type where SFoo3 :: forall a (n :: a). (Sing n) -> SFoo3 (Foo3 n :: Foo3 a) type instance Sing @(Foo3 a) = SFoo3 instance SingKind a => SingKind (Foo3 a) where type Demote (Foo3 a) = Foo3 (Demote a) fromSing (SFoo3 b) = Foo3 (fromSing b) toSing (Foo3 (b :: Demote a)) = case toSing b :: SomeSing a of SomeSing c -> SomeSing (SFoo3 c) data SFoo4 :: forall (a :: Type) (b :: Type). Foo4 a b -> Type where SFoo41 :: forall (a :: Type) (b :: Type). SFoo4 (Foo41 :: Foo4 (a :: Type) (b :: Type)) SFoo42 :: forall (a :: Type) (b :: Type). SFoo4 (Foo42 :: Foo4 (a :: Type) (b :: Type)) type instance Sing @(Foo4 a b) = SFoo4 instance (SingKind a, SingKind b) => SingKind (Foo4 a b) where type Demote (Foo4 a b) = Foo4 (Demote a) (Demote b) fromSing SFoo41 = Foo41 fromSing SFoo42 = Foo42 toSing Foo41 = SomeSing SFoo41 toSing Foo42 = SomeSing SFoo42 data SPair :: Pair -> Type where SPair :: forall (n :: Bool) (n :: Bool). (Sing n) -> (Sing n) -> SPair (Pair n n :: Pair) type instance Sing @Pair = SPair instance SingKind Pair where type Demote Pair = Pair fromSing (SPair b b) = Pair (fromSing b) (fromSing b) toSing (Pair (b :: Demote Bool) (b :: Demote Bool)) = case (,) (toSing b :: SomeSing Bool) (toSing b :: SomeSing Bool) of (,) (SomeSing c) (SomeSing c) -> SomeSing (SPair c c) instance SBounded Foo1 where sMinBound :: Sing (MinBoundSym0 :: Foo1) sMaxBound :: Sing (MaxBoundSym0 :: Foo1) sMinBound = SFoo1 sMaxBound = SFoo1 instance SBounded Foo2 where sMinBound :: Sing (MinBoundSym0 :: Foo2) sMaxBound :: Sing (MaxBoundSym0 :: Foo2) sMinBound = SA sMaxBound = SE instance SBounded a => SBounded (Foo3 a) where sMinBound :: Sing (MinBoundSym0 :: Foo3 a) sMaxBound :: Sing (MaxBoundSym0 :: Foo3 a) sMinBound = applySing (singFun1 @Foo3Sym0 SFoo3) sMinBound sMaxBound = applySing (singFun1 @Foo3Sym0 SFoo3) sMaxBound instance SBounded (Foo4 a b) where sMinBound :: Sing (MinBoundSym0 :: Foo4 a b) sMaxBound :: Sing (MaxBoundSym0 :: Foo4 a b) sMinBound = SFoo41 sMaxBound = SFoo42 instance SBounded Bool => SBounded Pair where sMinBound :: Sing (MinBoundSym0 :: Pair) sMaxBound :: Sing (MaxBoundSym0 :: Pair) sMinBound = applySing (applySing (singFun2 @PairSym0 SPair) sMinBound) sMinBound sMaxBound = applySing (applySing (singFun2 @PairSym0 SPair) sMaxBound) sMaxBound instance SingI Foo1 where sing = SFoo1 instance SingI A where sing = SA instance SingI B where sing = SB instance SingI C where sing = SC instance SingI D where sing = SD instance SingI E where sing = SE instance SingI n => SingI (Foo3 (n :: a)) where sing = SFoo3 sing instance SingI1 Foo3 where liftSing = SFoo3 instance SingI (Foo3Sym0 :: (~>) a (Foo3 a)) where sing = singFun1 @Foo3Sym0 SFoo3 instance SingI Foo41 where sing = SFoo41 instance SingI Foo42 where sing = SFoo42 instance (SingI n, SingI n) => SingI (Pair (n :: Bool) (n :: Bool)) where sing = SPair sing sing instance SingI n => SingI1 (Pair (n :: Bool)) where liftSing = SPair sing instance SingI2 Pair where liftSing2 = SPair instance SingI (PairSym0 :: (~>) Bool ((~>) Bool Pair)) where sing = singFun2 @PairSym0 SPair instance SingI d => SingI (PairSym1 (d :: Bool) :: (~>) Bool Pair) where sing = singFun1 @(PairSym1 (d :: Bool)) (SPair (sing @d)) instance SingI1 (PairSym1 :: Bool -> (~>) Bool Pair) where liftSing (s :: Sing (d :: Bool)) = singFun1 @(PairSym1 (d :: Bool)) (SPair s)