summaryrefslogtreecommitdiff
path: root/testsuite/tests/stranal/should_compile/T18982.hs
blob: e451d6bb76c54a1013c651a8e52e604ce88e562a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{-# OPTIONS_GHC -O -fforce-recomp #-}
{-# LANGUAGE GADTs #-}

module T18982 where

data Box a where
  Box :: a -> Box a

data Ex a where
  Ex :: e -> a -> Ex a

data GADT a where
  GADT :: Int -> GADT Int

data ExGADT a where
  ExGADT :: (e ~ Int) => e -> Int -> ExGADT Int

-- | Expected worker type:
-- $wf :: Int# -> Int#
f :: Box Int -> Int
f (Box n) = n + 1
{-# NOINLINE f #-}

-- | Expected worker type:
-- $wg :: forall {e}. e -> Int# -> Int#
g :: Ex Int -> Int
g (Ex e n) = e `seq` n + 1
{-# NOINLINE g #-}

-- | Expected worker type:
-- $wh :: Int# -> Int#
h :: GADT a -> Int
h (GADT n) = n + 1
{-# NOINLINE h #-}

-- | Expected worker type:
-- $wi :: forall {e}. e -> Int# -> Int#
i :: ExGADT a -> Int
i (ExGADT e n) = e `seq` n + 1
{-# NOINLINE i #-}