packages feed

singletons-2.6: tests/compile-and-dump/Singletons/BoundedDeriving.ghc88.template

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 ASym0 = A
    type BSym0 = B
    type CSym0 = C
    type DSym0 = D
    type ESym0 = E
    type Foo3Sym1 (t0123456789876543210 :: a0123456789876543210) =
        Foo3 t0123456789876543210
    instance SuppressUnusedWarnings Foo3Sym0 where
      suppressUnusedWarnings = snd (((,) Foo3Sym0KindInference) ())
    data Foo3Sym0 :: forall a0123456789876543210.
                     (~>) a0123456789876543210 (Foo3 a0123456789876543210)
      where
        Foo3Sym0KindInference :: forall t0123456789876543210
                                        arg. SameKind (Apply Foo3Sym0 arg) (Foo3Sym1 arg) =>
                                 Foo3Sym0 t0123456789876543210
    type instance Apply Foo3Sym0 t0123456789876543210 = Foo3 t0123456789876543210
    type Foo41Sym0 = Foo41
    type Foo42Sym0 = Foo42
    type PairSym2 (t0123456789876543210 :: Bool) (t0123456789876543210 :: Bool) =
        Pair t0123456789876543210 t0123456789876543210
    instance SuppressUnusedWarnings (PairSym1 t0123456789876543210) where
      suppressUnusedWarnings = snd (((,) PairSym1KindInference) ())
    data PairSym1 (t0123456789876543210 :: Bool) :: (~>) Bool Pair
      where
        PairSym1KindInference :: forall t0123456789876543210
                                        t0123456789876543210
                                        arg. SameKind (Apply (PairSym1 t0123456789876543210) arg) (PairSym2 t0123456789876543210 arg) =>
                                 PairSym1 t0123456789876543210 t0123456789876543210
    type instance Apply (PairSym1 t0123456789876543210) t0123456789876543210 = Pair t0123456789876543210 t0123456789876543210
    instance SuppressUnusedWarnings PairSym0 where
      suppressUnusedWarnings = snd (((,) PairSym0KindInference) ())
    data PairSym0 :: (~>) Bool ((~>) Bool Pair)
      where
        PairSym0KindInference :: forall t0123456789876543210
                                        arg. SameKind (Apply PairSym0 arg) (PairSym1 arg) =>
                                 PairSym0 t0123456789876543210
    type instance Apply PairSym0 t0123456789876543210 = PairSym1 t0123456789876543210
    type family MinBound_0123456789876543210 :: Foo1 where
      MinBound_0123456789876543210 = Foo1Sym0
    type MinBound_0123456789876543210Sym0 =
        MinBound_0123456789876543210
    type family MaxBound_0123456789876543210 :: Foo1 where
      MaxBound_0123456789876543210 = Foo1Sym0
    type MaxBound_0123456789876543210Sym0 =
        MaxBound_0123456789876543210
    instance PBounded Foo1 where
      type MinBound = MinBound_0123456789876543210Sym0
      type MaxBound = MaxBound_0123456789876543210Sym0
    type family MinBound_0123456789876543210 :: Foo2 where
      MinBound_0123456789876543210 = ASym0
    type MinBound_0123456789876543210Sym0 =
        MinBound_0123456789876543210
    type family MaxBound_0123456789876543210 :: Foo2 where
      MaxBound_0123456789876543210 = ESym0
    type MaxBound_0123456789876543210Sym0 =
        MaxBound_0123456789876543210
    instance PBounded Foo2 where
      type MinBound = MinBound_0123456789876543210Sym0
      type MaxBound = MaxBound_0123456789876543210Sym0
    type family MinBound_0123456789876543210 :: Foo3 a where
      MinBound_0123456789876543210 = Apply Foo3Sym0 MinBoundSym0
    type MinBound_0123456789876543210Sym0 =
        MinBound_0123456789876543210
    type family MaxBound_0123456789876543210 :: Foo3 a where
      MaxBound_0123456789876543210 = Apply Foo3Sym0 MaxBoundSym0
    type MaxBound_0123456789876543210Sym0 =
        MaxBound_0123456789876543210
    instance PBounded (Foo3 a) where
      type MinBound = MinBound_0123456789876543210Sym0
      type MaxBound = MaxBound_0123456789876543210Sym0
    type family MinBound_0123456789876543210 :: Foo4 a b where
      MinBound_0123456789876543210 = Foo41Sym0
    type MinBound_0123456789876543210Sym0 =
        MinBound_0123456789876543210
    type family MaxBound_0123456789876543210 :: Foo4 a b where
      MaxBound_0123456789876543210 = Foo42Sym0
    type MaxBound_0123456789876543210Sym0 =
        MaxBound_0123456789876543210
    instance PBounded (Foo4 a b) where
      type MinBound = MinBound_0123456789876543210Sym0
      type MaxBound = MaxBound_0123456789876543210Sym0
    type family MinBound_0123456789876543210 :: Pair where
      MinBound_0123456789876543210 = Apply (Apply PairSym0 MinBoundSym0) MinBoundSym0
    type MinBound_0123456789876543210Sym0 =
        MinBound_0123456789876543210
    type family MaxBound_0123456789876543210 :: Pair where
      MaxBound_0123456789876543210 = Apply (Apply PairSym0 MaxBoundSym0) MaxBoundSym0
    type MaxBound_0123456789876543210Sym0 =
        MaxBound_0123456789876543210
    instance PBounded Pair where
      type MinBound = MinBound_0123456789876543210Sym0
      type MaxBound = MaxBound_0123456789876543210Sym0
    data SFoo1 :: Foo1 -> Type where SFoo1 :: SFoo1 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
        SB :: SFoo2 B
        SC :: SFoo2 C
        SD :: SFoo2 D
        SE :: SFoo2 E
    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 :: a)) -> SFoo3 (Foo3 n)
    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 b. Foo4 a b -> Type
      where
        SFoo41 :: SFoo4 Foo41
        SFoo42 :: SFoo4 Foo42
    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 :: Bool)) -> (Sing (n :: Bool)) -> SPair (Pair n n)
    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 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 (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))