singletons-base-3.3: 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 Case_0123456789876543210 arg_01234567898765432100123456789876543210 y0123456789876543210 x0123456789876543210 t where
Case_0123456789876543210 arg_0123456789876543210 y x _ = x
type family Lambda_0123456789876543210 y0123456789876543210 x0123456789876543210 arg_0123456789876543210 where
Lambda_0123456789876543210 y x arg_0123456789876543210 = Case_0123456789876543210 arg_0123456789876543210 y x arg_0123456789876543210
data Lambda_0123456789876543210Sym0 y0123456789876543210
where
Lambda_0123456789876543210Sym0KindInference :: SameKind (Apply Lambda_0123456789876543210Sym0 arg) (Lambda_0123456789876543210Sym1 arg) =>
Lambda_0123456789876543210Sym0 y0123456789876543210
type instance Apply Lambda_0123456789876543210Sym0 y0123456789876543210 = Lambda_0123456789876543210Sym1 y0123456789876543210
instance SuppressUnusedWarnings Lambda_0123456789876543210Sym0 where
suppressUnusedWarnings
= snd ((,) Lambda_0123456789876543210Sym0KindInference ())
data Lambda_0123456789876543210Sym1 y0123456789876543210 x0123456789876543210
where
Lambda_0123456789876543210Sym1KindInference :: SameKind (Apply (Lambda_0123456789876543210Sym1 y0123456789876543210) arg) (Lambda_0123456789876543210Sym2 y0123456789876543210 arg) =>
Lambda_0123456789876543210Sym1 y0123456789876543210 x0123456789876543210
type instance Apply (Lambda_0123456789876543210Sym1 y0123456789876543210) x0123456789876543210 = Lambda_0123456789876543210Sym2 y0123456789876543210 x0123456789876543210
instance SuppressUnusedWarnings (Lambda_0123456789876543210Sym1 y0123456789876543210) where
suppressUnusedWarnings
= snd ((,) Lambda_0123456789876543210Sym1KindInference ())
data Lambda_0123456789876543210Sym2 y0123456789876543210 x0123456789876543210 arg_01234567898765432100123456789876543210
where
Lambda_0123456789876543210Sym2KindInference :: SameKind (Apply (Lambda_0123456789876543210Sym2 y0123456789876543210 x0123456789876543210) arg) (Lambda_0123456789876543210Sym3 y0123456789876543210 x0123456789876543210 arg) =>
Lambda_0123456789876543210Sym2 y0123456789876543210 x0123456789876543210 arg_01234567898765432100123456789876543210
type instance Apply (Lambda_0123456789876543210Sym2 y0123456789876543210 x0123456789876543210) arg_01234567898765432100123456789876543210 = Lambda_0123456789876543210 y0123456789876543210 x0123456789876543210 arg_01234567898765432100123456789876543210
instance SuppressUnusedWarnings (Lambda_0123456789876543210Sym2 y0123456789876543210 x0123456789876543210) where
suppressUnusedWarnings
= snd ((,) Lambda_0123456789876543210Sym2KindInference ())
type family Lambda_0123456789876543210Sym3 y0123456789876543210 x0123456789876543210 arg_01234567898765432100123456789876543210 where
Lambda_0123456789876543210Sym3 y0123456789876543210 x0123456789876543210 arg_01234567898765432100123456789876543210 = Lambda_0123456789876543210 y0123456789876543210 x0123456789876543210 arg_01234567898765432100123456789876543210
type family Case_0123456789876543210 x0123456789876543210 t where
Case_0123456789876543210 x y = Apply (Apply (Apply Lambda_0123456789876543210Sym0 y) x) y
data Let0123456789876543210ZSym0 a0123456789876543210
where
Let0123456789876543210ZSym0KindInference :: SameKind (Apply Let0123456789876543210ZSym0 arg) (Let0123456789876543210ZSym1 arg) =>
Let0123456789876543210ZSym0 a0123456789876543210
type instance Apply Let0123456789876543210ZSym0 a0123456789876543210 = Let0123456789876543210ZSym1 a0123456789876543210
instance SuppressUnusedWarnings Let0123456789876543210ZSym0 where
suppressUnusedWarnings
= snd ((,) Let0123456789876543210ZSym0KindInference ())
data Let0123456789876543210ZSym1 a0123456789876543210 y0123456789876543210
where
Let0123456789876543210ZSym1KindInference :: SameKind (Apply (Let0123456789876543210ZSym1 a0123456789876543210) arg) (Let0123456789876543210ZSym2 a0123456789876543210 arg) =>
Let0123456789876543210ZSym1 a0123456789876543210 y0123456789876543210
type instance Apply (Let0123456789876543210ZSym1 a0123456789876543210) y0123456789876543210 = Let0123456789876543210ZSym2 a0123456789876543210 y0123456789876543210
instance SuppressUnusedWarnings (Let0123456789876543210ZSym1 a0123456789876543210) where
suppressUnusedWarnings
= snd ((,) Let0123456789876543210ZSym1KindInference ())
data Let0123456789876543210ZSym2 a0123456789876543210 y0123456789876543210 x0123456789876543210
where
Let0123456789876543210ZSym2KindInference :: SameKind (Apply (Let0123456789876543210ZSym2 a0123456789876543210 y0123456789876543210) arg) (Let0123456789876543210ZSym3 a0123456789876543210 y0123456789876543210 arg) =>
Let0123456789876543210ZSym2 a0123456789876543210 y0123456789876543210 x0123456789876543210
type instance Apply (Let0123456789876543210ZSym2 a0123456789876543210 y0123456789876543210) x0123456789876543210 = Let0123456789876543210Z a0123456789876543210 y0123456789876543210 x0123456789876543210
instance SuppressUnusedWarnings (Let0123456789876543210ZSym2 a0123456789876543210 y0123456789876543210) where
suppressUnusedWarnings
= snd ((,) Let0123456789876543210ZSym2KindInference ())
type family Let0123456789876543210ZSym3 a0123456789876543210 y0123456789876543210 x0123456789876543210 :: a0123456789876543210 where
Let0123456789876543210ZSym3 a0123456789876543210 y0123456789876543210 x0123456789876543210 = Let0123456789876543210Z a0123456789876543210 y0123456789876543210 x0123456789876543210
type family Let0123456789876543210Z a0123456789876543210 y0123456789876543210 x0123456789876543210 :: a0123456789876543210 where
Let0123456789876543210Z a y x = y
type family Case_0123456789876543210 a0123456789876543210 x0123456789876543210 t where
Case_0123456789876543210 a x y = Let0123456789876543210ZSym3 a y x
data Let0123456789876543210Scrutinee_0123456789876543210Sym0 a0123456789876543210
where
Let0123456789876543210Scrutinee_0123456789876543210Sym0KindInference :: SameKind (Apply Let0123456789876543210Scrutinee_0123456789876543210Sym0 arg) (Let0123456789876543210Scrutinee_0123456789876543210Sym1 arg) =>
Let0123456789876543210Scrutinee_0123456789876543210Sym0 a0123456789876543210
type instance Apply Let0123456789876543210Scrutinee_0123456789876543210Sym0 a0123456789876543210 = Let0123456789876543210Scrutinee_0123456789876543210Sym1 a0123456789876543210
instance SuppressUnusedWarnings Let0123456789876543210Scrutinee_0123456789876543210Sym0 where
suppressUnusedWarnings
= snd
((,)
Let0123456789876543210Scrutinee_0123456789876543210Sym0KindInference
())
data Let0123456789876543210Scrutinee_0123456789876543210Sym1 a0123456789876543210 b0123456789876543210
where
Let0123456789876543210Scrutinee_0123456789876543210Sym1KindInference :: SameKind (Apply (Let0123456789876543210Scrutinee_0123456789876543210Sym1 a0123456789876543210) arg) (Let0123456789876543210Scrutinee_0123456789876543210Sym2 a0123456789876543210 arg) =>
Let0123456789876543210Scrutinee_0123456789876543210Sym1 a0123456789876543210 b0123456789876543210
type instance Apply (Let0123456789876543210Scrutinee_0123456789876543210Sym1 a0123456789876543210) b0123456789876543210 = Let0123456789876543210Scrutinee_0123456789876543210 a0123456789876543210 b0123456789876543210
instance SuppressUnusedWarnings (Let0123456789876543210Scrutinee_0123456789876543210Sym1 a0123456789876543210) where
suppressUnusedWarnings
= snd
((,)
Let0123456789876543210Scrutinee_0123456789876543210Sym1KindInference
())
type family Let0123456789876543210Scrutinee_0123456789876543210Sym2 a0123456789876543210 b0123456789876543210 where
Let0123456789876543210Scrutinee_0123456789876543210Sym2 a0123456789876543210 b0123456789876543210 = Let0123456789876543210Scrutinee_0123456789876543210 a0123456789876543210 b0123456789876543210
type family Let0123456789876543210Scrutinee_0123456789876543210 a0123456789876543210 b0123456789876543210 where
Let0123456789876543210Scrutinee_0123456789876543210 a b = Apply (Apply Tuple2Sym0 a) b
type family Case_0123456789876543210 a0123456789876543210 b0123456789876543210 t where
Case_0123456789876543210 a b '(p, _) = p
data Let0123456789876543210Scrutinee_0123456789876543210Sym0 d0123456789876543210
where
Let0123456789876543210Scrutinee_0123456789876543210Sym0KindInference :: SameKind (Apply Let0123456789876543210Scrutinee_0123456789876543210Sym0 arg) (Let0123456789876543210Scrutinee_0123456789876543210Sym1 arg) =>
Let0123456789876543210Scrutinee_0123456789876543210Sym0 d0123456789876543210
type instance Apply Let0123456789876543210Scrutinee_0123456789876543210Sym0 d0123456789876543210 = Let0123456789876543210Scrutinee_0123456789876543210 d0123456789876543210
instance SuppressUnusedWarnings Let0123456789876543210Scrutinee_0123456789876543210Sym0 where
suppressUnusedWarnings
= snd
((,)
Let0123456789876543210Scrutinee_0123456789876543210Sym0KindInference
())
type family Let0123456789876543210Scrutinee_0123456789876543210Sym1 d0123456789876543210 where
Let0123456789876543210Scrutinee_0123456789876543210Sym1 d0123456789876543210 = Let0123456789876543210Scrutinee_0123456789876543210 d0123456789876543210
type family Let0123456789876543210Scrutinee_0123456789876543210 d0123456789876543210 where
Let0123456789876543210Scrutinee_0123456789876543210 d = Apply JustSym0 d
type family Case_0123456789876543210 d0123456789876543210 t where
Case_0123456789876543210 d ('Just y) = y
type family Case_0123456789876543210 d0123456789876543210 x0123456789876543210 t where
Case_0123456789876543210 d x ('Just y) = y
Case_0123456789876543210 d x 'Nothing = d
type Foo5Sym0 :: (~>) a a
data Foo5Sym0 :: (~>) a a
where
Foo5Sym0KindInference :: SameKind (Apply Foo5Sym0 arg) (Foo5Sym1 arg) =>
Foo5Sym0 a0123456789876543210
type instance Apply Foo5Sym0 a0123456789876543210 = Foo5 a0123456789876543210
instance SuppressUnusedWarnings Foo5Sym0 where
suppressUnusedWarnings = snd ((,) Foo5Sym0KindInference ())
type Foo5Sym1 :: a -> a
type family Foo5Sym1 (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 Foo4Sym0 a0123456789876543210 = Foo4 a0123456789876543210
instance SuppressUnusedWarnings Foo4Sym0 where
suppressUnusedWarnings = snd ((,) Foo4Sym0KindInference ())
type Foo4Sym1 :: forall a. a -> a
type family Foo4Sym1 (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 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 (Foo3Sym1 a0123456789876543210) a0123456789876543210 = Foo3 a0123456789876543210 a0123456789876543210
instance SuppressUnusedWarnings (Foo3Sym1 a0123456789876543210) where
suppressUnusedWarnings = snd ((,) Foo3Sym1KindInference ())
type Foo3Sym2 :: a -> b -> a
type family Foo3Sym2 (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 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 (Foo2Sym1 a0123456789876543210) a0123456789876543210 = Foo2 a0123456789876543210 a0123456789876543210
instance SuppressUnusedWarnings (Foo2Sym1 a0123456789876543210) where
suppressUnusedWarnings = snd ((,) Foo2Sym1KindInference ())
type Foo2Sym2 :: a -> Maybe a -> a
type family Foo2Sym2 (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 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 (Foo1Sym1 a0123456789876543210) a0123456789876543210 = Foo1 a0123456789876543210 a0123456789876543210
instance SuppressUnusedWarnings (Foo1Sym1 a0123456789876543210) where
suppressUnusedWarnings = snd ((,) Foo1Sym1KindInference ())
type Foo1Sym2 :: a -> Maybe a -> a
type family Foo1Sym2 (a0123456789876543210 :: a) (a0123456789876543210 :: Maybe a) :: a where
Foo1Sym2 a0123456789876543210 a0123456789876543210 = Foo1 a0123456789876543210 a0123456789876543210
type Foo5 :: a -> a
type family Foo5 (a :: a) :: a where
Foo5 x = Case_0123456789876543210 x x
type Foo4 :: forall a. a -> a
type family Foo4 (a :: a) :: a where
Foo4 @a (x :: a) = Case_0123456789876543210 a x x
type Foo3 :: a -> b -> a
type family Foo3 (a :: a) (a :: b) :: a where
Foo3 a b = Case_0123456789876543210 a b (Let0123456789876543210Scrutinee_0123456789876543210Sym2 a b)
type Foo2 :: a -> Maybe a -> a
type family Foo2 (a :: a) (a :: Maybe a) :: a where
Foo2 d _ = Case_0123456789876543210 d (Let0123456789876543210Scrutinee_0123456789876543210Sym1 d)
type Foo1 :: a -> Maybe a -> a
type family Foo1 (a :: a) (a :: Maybe a) :: a where
Foo1 d x = Case_0123456789876543210 d x x
sFoo5 ::
(forall (t :: a). Sing t -> Sing (Apply Foo5Sym0 t :: a) :: Type)
sFoo4 :: forall a (t :: a). Sing t -> Sing (Apply Foo4Sym0 t :: a)
sFoo3 ::
(forall (t :: a) (t :: b).
Sing t -> Sing t -> Sing (Apply (Apply Foo3Sym0 t) t :: a) :: Type)
sFoo2 ::
(forall (t :: a) (t :: Maybe a).
Sing t -> Sing t -> Sing (Apply (Apply Foo2Sym0 t) t :: a) :: Type)
sFoo1 ::
(forall (t :: a) (t :: Maybe a).
Sing t -> Sing t -> Sing (Apply (Apply Foo1Sym0 t) t :: a) :: Type)
sFoo5 (sX :: Sing x)
= id
@(Sing (Case_0123456789876543210 x x))
(case sX of
(sY :: Sing y)
-> applySing
(singFun1
@(Apply (Apply Lambda_0123456789876543210Sym0 y) x)
(\ sArg_0123456789876543210
-> case sArg_0123456789876543210 of
(_ :: Sing arg_0123456789876543210)
-> id
@(Sing (Case_0123456789876543210 arg_0123456789876543210 y x arg_0123456789876543210))
(case sArg_0123456789876543210 of _ -> sX)))
sY)
sFoo4 (sX :: Sing x)
= id
@(Sing (Case_0123456789876543210 a x x))
(case sX of
(sY :: Sing y)
-> let
sZ :: (Sing (Let0123456789876543210ZSym3 a y x :: a) :: Type)
sZ = sY
in sZ)
sFoo3 (sA :: Sing a) (sB :: Sing b)
= let
sScrutinee_0123456789876543210 ::
Sing @_ (Let0123456789876543210Scrutinee_0123456789876543210Sym2 a b)
sScrutinee_0123456789876543210
= applySing (applySing (singFun2 @Tuple2Sym0 STuple2) sA) sB
in
id
@(Sing (Case_0123456789876543210 a b (Let0123456789876543210Scrutinee_0123456789876543210Sym2 a b)))
(case sScrutinee_0123456789876543210 of
STuple2 (sP :: Sing p) _ -> sP)
sFoo2 (sD :: Sing d) _
= let
sScrutinee_0123456789876543210 ::
Sing @_ (Let0123456789876543210Scrutinee_0123456789876543210Sym1 d)
sScrutinee_0123456789876543210
= applySing (singFun1 @JustSym0 SJust) sD
in
id
@(Sing (Case_0123456789876543210 d (Let0123456789876543210Scrutinee_0123456789876543210Sym1 d)))
(case sScrutinee_0123456789876543210 of SJust (sY :: Sing y) -> sY)
sFoo1 (sD :: Sing d) (sX :: Sing x)
= id
@(Sing (Case_0123456789876543210 d x x))
(case sX of
SJust (sY :: Sing y) -> sY
SNothing -> sD)
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)