packages feed

singletons-base-3.5.1: tests/compile-and-dump/Singletons/CaseExpressions.golden

Singletons/CaseExpressions.hs:(0,0)-(0,0): Splicing declarations
    singletons
      [d| foo1 :: a -> Maybe a -> a
          foo1 d x
            = case x of
                Just y -> y
                Nothing -> d
          foo2 :: a -> Maybe a -> a
          foo2 d _ = case (Just d) of Just y -> y
          foo3 :: a -> b -> a
          foo3 a b = case (a, b) of (p, _) -> p
          foo4 :: forall a. a -> a
          foo4 x
            = case x of
                y -> let
                       z :: a
                       z = y
                     in z
          foo5 :: a -> a
          foo5 x = case x of y -> (\ _ -> x) y |]
  ======>
    foo1 :: a -> Maybe a -> a
    foo1 d x
      = case x of
          Just y -> y
          Nothing -> d
    foo2 :: a -> Maybe a -> a
    foo2 d _ = case Just d of Just y -> y
    foo3 :: a -> b -> a
    foo3 a b = case (a, b) of (p, _) -> p
    foo4 :: forall a. a -> a
    foo4 x
      = case x of
          y -> let
                 z :: a
                 z = y
               in z
    foo5 :: a -> a
    foo5 x = case x of y -> (\ _ -> x) y
    type family LamCases_0123456789876543210 y0123456789876543210 (x0123456789876543210 :: a0123456789876543210) a_0123456789876543210 where
      LamCases_0123456789876543210 y x _ = x
    data LamCases_0123456789876543210Sym0 y0123456789876543210 (x0123456789876543210 :: a0123456789876543210) a_01234567898765432100123456789876543210
      where
        LamCases_0123456789876543210Sym0KindInference :: SameKind (Apply (LamCases_0123456789876543210Sym0 y0123456789876543210 x0123456789876543210) arg) (LamCases_0123456789876543210Sym1 y0123456789876543210 x0123456789876543210 arg) =>
                                                         LamCases_0123456789876543210Sym0 y0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210
    type instance Apply @_ @_ (LamCases_0123456789876543210Sym0 y0123456789876543210 x0123456789876543210) a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 y0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210
    instance SuppressUnusedWarnings (LamCases_0123456789876543210Sym0 y0123456789876543210 x0123456789876543210) where
      suppressUnusedWarnings
        = snd ((,) LamCases_0123456789876543210Sym0KindInference ())
    type family LamCases_0123456789876543210Sym1 y0123456789876543210 (x0123456789876543210 :: a0123456789876543210) a_01234567898765432100123456789876543210 where
      LamCases_0123456789876543210Sym1 y0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 y0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210
    type family LamCases_0123456789876543210 (x0123456789876543210 :: a0123456789876543210) a_0123456789876543210 where
      LamCases_0123456789876543210 x y = Apply (LamCases_0123456789876543210Sym0 y x) y
    data LamCases_0123456789876543210Sym0 (x0123456789876543210 :: a0123456789876543210) a_01234567898765432100123456789876543210
      where
        LamCases_0123456789876543210Sym0KindInference :: SameKind (Apply (LamCases_0123456789876543210Sym0 x0123456789876543210) arg) (LamCases_0123456789876543210Sym1 x0123456789876543210 arg) =>
                                                         LamCases_0123456789876543210Sym0 x0123456789876543210 a_01234567898765432100123456789876543210
    type instance Apply @_ @_ (LamCases_0123456789876543210Sym0 x0123456789876543210) a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210
    instance SuppressUnusedWarnings (LamCases_0123456789876543210Sym0 x0123456789876543210) where
      suppressUnusedWarnings
        = snd ((,) LamCases_0123456789876543210Sym0KindInference ())
    type family LamCases_0123456789876543210Sym1 (x0123456789876543210 :: a0123456789876543210) a_01234567898765432100123456789876543210 where
      LamCases_0123456789876543210Sym1 x0123456789876543210 a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210
    type family Let0123456789876543210ZSym0 a0123456789876543210 y0123456789876543210 (x0123456789876543210 :: a0123456789876543210) :: a0123456789876543210 where
      Let0123456789876543210ZSym0 a0123456789876543210 y0123456789876543210 x0123456789876543210 = Let0123456789876543210Z a0123456789876543210 y0123456789876543210 x0123456789876543210
    type family Let0123456789876543210Z a0123456789876543210 y0123456789876543210 (x0123456789876543210 :: a0123456789876543210) :: a0123456789876543210 where
      Let0123456789876543210Z a y x = y
    type family LamCases_0123456789876543210 a0123456789876543210 (x0123456789876543210 :: a0123456789876543210) a_0123456789876543210 where
      LamCases_0123456789876543210 a x y = Let0123456789876543210ZSym0 a y x
    data LamCases_0123456789876543210Sym0 a0123456789876543210 (x0123456789876543210 :: a0123456789876543210) a_01234567898765432100123456789876543210
      where
        LamCases_0123456789876543210Sym0KindInference :: SameKind (Apply (LamCases_0123456789876543210Sym0 a0123456789876543210 x0123456789876543210) arg) (LamCases_0123456789876543210Sym1 a0123456789876543210 x0123456789876543210 arg) =>
                                                         LamCases_0123456789876543210Sym0 a0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210
    type instance Apply @_ @_ (LamCases_0123456789876543210Sym0 a0123456789876543210 x0123456789876543210) a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 a0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210
    instance SuppressUnusedWarnings (LamCases_0123456789876543210Sym0 a0123456789876543210 x0123456789876543210) where
      suppressUnusedWarnings
        = snd ((,) LamCases_0123456789876543210Sym0KindInference ())
    type family LamCases_0123456789876543210Sym1 a0123456789876543210 (x0123456789876543210 :: a0123456789876543210) a_01234567898765432100123456789876543210 where
      LamCases_0123456789876543210Sym1 a0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 a0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210
    type family LamCases_0123456789876543210 (a0123456789876543210 :: a0123456789876543210) (b0123456789876543210 :: b0123456789876543210) a_0123456789876543210 where
      LamCases_0123456789876543210 a b '(p, _) = p
    data LamCases_0123456789876543210Sym0 (a0123456789876543210 :: a0123456789876543210) (b0123456789876543210 :: b0123456789876543210) a_01234567898765432100123456789876543210
      where
        LamCases_0123456789876543210Sym0KindInference :: SameKind (Apply (LamCases_0123456789876543210Sym0 a0123456789876543210 b0123456789876543210) arg) (LamCases_0123456789876543210Sym1 a0123456789876543210 b0123456789876543210 arg) =>
                                                         LamCases_0123456789876543210Sym0 a0123456789876543210 b0123456789876543210 a_01234567898765432100123456789876543210
    type instance Apply @_ @_ (LamCases_0123456789876543210Sym0 a0123456789876543210 b0123456789876543210) a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 a0123456789876543210 b0123456789876543210 a_01234567898765432100123456789876543210
    instance SuppressUnusedWarnings (LamCases_0123456789876543210Sym0 a0123456789876543210 b0123456789876543210) where
      suppressUnusedWarnings
        = snd ((,) LamCases_0123456789876543210Sym0KindInference ())
    type family LamCases_0123456789876543210Sym1 (a0123456789876543210 :: a0123456789876543210) (b0123456789876543210 :: b0123456789876543210) a_01234567898765432100123456789876543210 where
      LamCases_0123456789876543210Sym1 a0123456789876543210 b0123456789876543210 a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 a0123456789876543210 b0123456789876543210 a_01234567898765432100123456789876543210
    type family LamCases_0123456789876543210 (d0123456789876543210 :: a0123456789876543210) a_0123456789876543210 where
      LamCases_0123456789876543210 d ('Just y) = y
    data LamCases_0123456789876543210Sym0 (d0123456789876543210 :: a0123456789876543210) a_01234567898765432100123456789876543210
      where
        LamCases_0123456789876543210Sym0KindInference :: SameKind (Apply (LamCases_0123456789876543210Sym0 d0123456789876543210) arg) (LamCases_0123456789876543210Sym1 d0123456789876543210 arg) =>
                                                         LamCases_0123456789876543210Sym0 d0123456789876543210 a_01234567898765432100123456789876543210
    type instance Apply @_ @_ (LamCases_0123456789876543210Sym0 d0123456789876543210) a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 d0123456789876543210 a_01234567898765432100123456789876543210
    instance SuppressUnusedWarnings (LamCases_0123456789876543210Sym0 d0123456789876543210) where
      suppressUnusedWarnings
        = snd ((,) LamCases_0123456789876543210Sym0KindInference ())
    type family LamCases_0123456789876543210Sym1 (d0123456789876543210 :: a0123456789876543210) a_01234567898765432100123456789876543210 where
      LamCases_0123456789876543210Sym1 d0123456789876543210 a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 d0123456789876543210 a_01234567898765432100123456789876543210
    type family LamCases_0123456789876543210 (d0123456789876543210 :: a0123456789876543210) (x0123456789876543210 :: Maybe a0123456789876543210) a_0123456789876543210 where
      LamCases_0123456789876543210 d x ('Just y) = y
      LamCases_0123456789876543210 d x 'Nothing = d
    data LamCases_0123456789876543210Sym0 (d0123456789876543210 :: a0123456789876543210) (x0123456789876543210 :: Maybe a0123456789876543210) a_01234567898765432100123456789876543210
      where
        LamCases_0123456789876543210Sym0KindInference :: SameKind (Apply (LamCases_0123456789876543210Sym0 d0123456789876543210 x0123456789876543210) arg) (LamCases_0123456789876543210Sym1 d0123456789876543210 x0123456789876543210 arg) =>
                                                         LamCases_0123456789876543210Sym0 d0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210
    type instance Apply @_ @_ (LamCases_0123456789876543210Sym0 d0123456789876543210 x0123456789876543210) a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 d0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210
    instance SuppressUnusedWarnings (LamCases_0123456789876543210Sym0 d0123456789876543210 x0123456789876543210) where
      suppressUnusedWarnings
        = snd ((,) LamCases_0123456789876543210Sym0KindInference ())
    type family LamCases_0123456789876543210Sym1 (d0123456789876543210 :: a0123456789876543210) (x0123456789876543210 :: Maybe a0123456789876543210) a_01234567898765432100123456789876543210 where
      LamCases_0123456789876543210Sym1 d0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210 = LamCases_0123456789876543210 d0123456789876543210 x0123456789876543210 a_01234567898765432100123456789876543210
    type Foo5Sym0 :: (~>) a a
    data Foo5Sym0 :: (~>) a a
      where
        Foo5Sym0KindInference :: SameKind (Apply Foo5Sym0 arg) (Foo5Sym1 arg) =>
                                 Foo5Sym0 a0123456789876543210
    type instance Apply @a @a Foo5Sym0 a0123456789876543210 = Foo5 a0123456789876543210
    instance SuppressUnusedWarnings Foo5Sym0 where
      suppressUnusedWarnings = snd ((,) Foo5Sym0KindInference ())
    type Foo5Sym1 :: a -> a
    type family Foo5Sym1 @a (a0123456789876543210 :: a) :: a where
      Foo5Sym1 a0123456789876543210 = Foo5 a0123456789876543210
    type Foo4Sym0 :: forall a. (~>) a a
    data Foo4Sym0 :: (~>) a a
      where
        Foo4Sym0KindInference :: SameKind (Apply Foo4Sym0 arg) (Foo4Sym1 arg) =>
                                 Foo4Sym0 a0123456789876543210
    type instance Apply @a @a Foo4Sym0 a0123456789876543210 = Foo4 a0123456789876543210
    instance SuppressUnusedWarnings Foo4Sym0 where
      suppressUnusedWarnings = snd ((,) Foo4Sym0KindInference ())
    type Foo4Sym1 :: forall a. a -> a
    type family Foo4Sym1 @a (a0123456789876543210 :: a) :: a where
      Foo4Sym1 a0123456789876543210 = Foo4 a0123456789876543210
    type Foo3Sym0 :: (~>) a ((~>) b a)
    data Foo3Sym0 :: (~>) a ((~>) b a)
      where
        Foo3Sym0KindInference :: SameKind (Apply Foo3Sym0 arg) (Foo3Sym1 arg) =>
                                 Foo3Sym0 a0123456789876543210
    type instance Apply @a @((~>) b a) Foo3Sym0 a0123456789876543210 = Foo3Sym1 a0123456789876543210
    instance SuppressUnusedWarnings Foo3Sym0 where
      suppressUnusedWarnings = snd ((,) Foo3Sym0KindInference ())
    type Foo3Sym1 :: a -> (~>) b a
    data Foo3Sym1 (a0123456789876543210 :: a) :: (~>) b a
      where
        Foo3Sym1KindInference :: SameKind (Apply (Foo3Sym1 a0123456789876543210) arg) (Foo3Sym2 a0123456789876543210 arg) =>
                                 Foo3Sym1 a0123456789876543210 a0123456789876543210
    type instance Apply @b @a (Foo3Sym1 a0123456789876543210) a0123456789876543210 = Foo3 a0123456789876543210 a0123456789876543210
    instance SuppressUnusedWarnings (Foo3Sym1 a0123456789876543210) where
      suppressUnusedWarnings = snd ((,) Foo3Sym1KindInference ())
    type Foo3Sym2 :: a -> b -> a
    type family Foo3Sym2 @a @b (a0123456789876543210 :: a) (a0123456789876543210 :: b) :: a where
      Foo3Sym2 a0123456789876543210 a0123456789876543210 = Foo3 a0123456789876543210 a0123456789876543210
    type Foo2Sym0 :: (~>) a ((~>) (Maybe a) a)
    data Foo2Sym0 :: (~>) a ((~>) (Maybe a) a)
      where
        Foo2Sym0KindInference :: SameKind (Apply Foo2Sym0 arg) (Foo2Sym1 arg) =>
                                 Foo2Sym0 a0123456789876543210
    type instance Apply @a @((~>) (Maybe a) a) Foo2Sym0 a0123456789876543210 = Foo2Sym1 a0123456789876543210
    instance SuppressUnusedWarnings Foo2Sym0 where
      suppressUnusedWarnings = snd ((,) Foo2Sym0KindInference ())
    type Foo2Sym1 :: a -> (~>) (Maybe a) a
    data Foo2Sym1 (a0123456789876543210 :: a) :: (~>) (Maybe a) a
      where
        Foo2Sym1KindInference :: SameKind (Apply (Foo2Sym1 a0123456789876543210) arg) (Foo2Sym2 a0123456789876543210 arg) =>
                                 Foo2Sym1 a0123456789876543210 a0123456789876543210
    type instance Apply @(Maybe a) @a (Foo2Sym1 a0123456789876543210) a0123456789876543210 = Foo2 a0123456789876543210 a0123456789876543210
    instance SuppressUnusedWarnings (Foo2Sym1 a0123456789876543210) where
      suppressUnusedWarnings = snd ((,) Foo2Sym1KindInference ())
    type Foo2Sym2 :: a -> Maybe a -> a
    type family Foo2Sym2 @a (a0123456789876543210 :: a) (a0123456789876543210 :: Maybe a) :: a where
      Foo2Sym2 a0123456789876543210 a0123456789876543210 = Foo2 a0123456789876543210 a0123456789876543210
    type Foo1Sym0 :: (~>) a ((~>) (Maybe a) a)
    data Foo1Sym0 :: (~>) a ((~>) (Maybe a) a)
      where
        Foo1Sym0KindInference :: SameKind (Apply Foo1Sym0 arg) (Foo1Sym1 arg) =>
                                 Foo1Sym0 a0123456789876543210
    type instance Apply @a @((~>) (Maybe a) a) Foo1Sym0 a0123456789876543210 = Foo1Sym1 a0123456789876543210
    instance SuppressUnusedWarnings Foo1Sym0 where
      suppressUnusedWarnings = snd ((,) Foo1Sym0KindInference ())
    type Foo1Sym1 :: a -> (~>) (Maybe a) a
    data Foo1Sym1 (a0123456789876543210 :: a) :: (~>) (Maybe a) a
      where
        Foo1Sym1KindInference :: SameKind (Apply (Foo1Sym1 a0123456789876543210) arg) (Foo1Sym2 a0123456789876543210 arg) =>
                                 Foo1Sym1 a0123456789876543210 a0123456789876543210
    type instance Apply @(Maybe a) @a (Foo1Sym1 a0123456789876543210) a0123456789876543210 = Foo1 a0123456789876543210 a0123456789876543210
    instance SuppressUnusedWarnings (Foo1Sym1 a0123456789876543210) where
      suppressUnusedWarnings = snd ((,) Foo1Sym1KindInference ())
    type Foo1Sym2 :: a -> Maybe a -> a
    type family Foo1Sym2 @a (a0123456789876543210 :: a) (a0123456789876543210 :: Maybe a) :: a where
      Foo1Sym2 a0123456789876543210 a0123456789876543210 = Foo1 a0123456789876543210 a0123456789876543210
    type Foo5 :: a -> a
    type family Foo5 @a (a :: a) :: a where
      Foo5 x = Apply (LamCases_0123456789876543210Sym0 x) x
    type Foo4 :: forall a. a -> a
    type family Foo4 @a (a :: a) :: a where
      Foo4 @a (x :: a) = Apply (LamCases_0123456789876543210Sym0 a x) x
    type Foo3 :: a -> b -> a
    type family Foo3 @a @b (a :: a) (a :: b) :: a where
      Foo3 a b = Apply (LamCases_0123456789876543210Sym0 a b) (Apply (Apply Tuple2Sym0 a) b)
    type Foo2 :: a -> Maybe a -> a
    type family Foo2 @a (a :: a) (a :: Maybe a) :: a where
      Foo2 d _ = Apply (LamCases_0123456789876543210Sym0 d) (Apply JustSym0 d)
    type Foo1 :: a -> Maybe a -> a
    type family Foo1 @a (a :: a) (a :: Maybe a) :: a where
      Foo1 d x = Apply (LamCases_0123456789876543210Sym0 d x) x
    sFoo5 :: (forall (t :: a). Sing t -> Sing (Foo5 t :: a) :: Type)
    sFoo4 :: forall a (t :: a). Sing t -> Sing (Foo4 t :: a)
    sFoo3 ::
      (forall (t :: a) (t :: b).
       Sing t -> Sing t -> Sing (Foo3 t t :: a) :: Type)
    sFoo2 ::
      (forall (t :: a) (t :: Maybe a).
       Sing t -> Sing t -> Sing (Foo2 t t :: a) :: Type)
    sFoo1 ::
      (forall (t :: a) (t :: Maybe a).
       Sing t -> Sing t -> Sing (Foo1 t t :: a) :: Type)
    sFoo5 (sX :: Sing x)
      = applySing
          (singFun1
             @(LamCases_0123456789876543210Sym0 x)
             (\cases
                (sY :: Sing y)
                  -> applySing
                       (singFun1 @(LamCases_0123456789876543210Sym0 y x) (\cases _ -> sX))
                       sY))
          sX
    sFoo4 (sX :: Sing x)
      = applySing
          (singFun1
             @(LamCases_0123456789876543210Sym0 a x)
             (\cases
                (sY :: Sing y)
                  -> let
                       sZ :: (Sing (Let0123456789876543210Z a y x :: a) :: Type)
                       sZ = sY
                     in sZ))
          sX
    sFoo3 (sA :: Sing a) (sB :: Sing b)
      = applySing
          (singFun1
             @(LamCases_0123456789876543210Sym0 a b)
             (\cases (STuple2 (sP :: Sing p) _) -> sP))
          (applySing (applySing (singFun2 @Tuple2Sym0 STuple2) sA) sB)
    sFoo2 (sD :: Sing d) _
      = applySing
          (singFun1
             @(LamCases_0123456789876543210Sym0 d)
             (\cases (SJust (sY :: Sing y)) -> sY))
          (applySing (singFun1 @JustSym0 SJust) sD)
    sFoo1 (sD :: Sing d) (sX :: Sing x)
      = applySing
          (singFun1
             @(LamCases_0123456789876543210Sym0 d x)
             (\cases
                (SJust (sY :: Sing y)) -> sY
                SNothing -> sD))
          sX
    instance SingI (Foo5Sym0 :: (~>) a a) where
      sing = singFun1 @Foo5Sym0 sFoo5
    instance SingI (Foo4Sym0 :: (~>) a a) where
      sing = singFun1 @Foo4Sym0 sFoo4
    instance SingI (Foo3Sym0 :: (~>) a ((~>) b a)) where
      sing = singFun2 @Foo3Sym0 sFoo3
    instance SingI d => SingI (Foo3Sym1 (d :: a) :: (~>) b a) where
      sing = singFun1 @(Foo3Sym1 (d :: a)) (sFoo3 (sing @d))
    instance SingI1 (Foo3Sym1 :: a -> (~>) b a) where
      liftSing (s :: Sing (d :: a))
        = singFun1 @(Foo3Sym1 (d :: a)) (sFoo3 s)
    instance SingI (Foo2Sym0 :: (~>) a ((~>) (Maybe a) a)) where
      sing = singFun2 @Foo2Sym0 sFoo2
    instance SingI d =>
             SingI (Foo2Sym1 (d :: a) :: (~>) (Maybe a) a) where
      sing = singFun1 @(Foo2Sym1 (d :: a)) (sFoo2 (sing @d))
    instance SingI1 (Foo2Sym1 :: a -> (~>) (Maybe a) a) where
      liftSing (s :: Sing (d :: a))
        = singFun1 @(Foo2Sym1 (d :: a)) (sFoo2 s)
    instance SingI (Foo1Sym0 :: (~>) a ((~>) (Maybe a) a)) where
      sing = singFun2 @Foo1Sym0 sFoo1
    instance SingI d =>
             SingI (Foo1Sym1 (d :: a) :: (~>) (Maybe a) a) where
      sing = singFun1 @(Foo1Sym1 (d :: a)) (sFoo1 (sing @d))
    instance SingI1 (Foo1Sym1 :: a -> (~>) (Maybe a) a) where
      liftSing (s :: Sing (d :: a))
        = singFun1 @(Foo1Sym1 (d :: a)) (sFoo1 s)