Update Trac ticket URLs to point to GitLab
[ghc.git] / testsuite / tests / gadt / Session.hs
1 {-# LANGUAGE GADTs, KindSignatures #-}
2
3 -- See #1323; crashed GHC 6.6
4
5 module Main where
6
7 import Data.Kind (Type)
8
9 data Zero = Zero
10 deriving (Show)
11
12 -- Change this newtype to a data and all's well
13 -- and it's not like the class restriction actually restricts
14 -- the type rather than the constructor
15 newtype Succ p = Succ p deriving (Show)
16
17 class TyNum a where
18 instance TyNum Zero where
19 instance (TyNum p) => TyNum (Succ p) where
20
21 data List :: Type -> Type -> Type where
22 Nil :: List a Zero
23 Cons :: (TyNum p) => a -> List a p -> List a (Succ p)
24
25 instance (Show a) => Show (List a l) where
26 show Nil = "Nil"
27 show (Cons a t) = "Cons " ++ (show a) ++ " (" ++ (show t) ++ ")"
28
29 zipL :: List a l -> List b l -> List (a, b) l
30 zipL Nil Nil = Nil -- this line is fine
31 zipL (Cons l ls) (Cons r rs) = Cons (l,r) (zipL ls rs) -- this line blows up
32
33 l1 = Cons 5 (Cons 3 Nil)
34 l2 = Cons True (Cons False Nil)
35
36 main = print $ zipL l1 l2
37
38 {-
39 $ ghc --make Test.hs
40 [1 of 1] Compiling Main ( Test.hs, Test.o )
41 ghc-6.6: panic! (the 'impossible' happened)
42 (GHC version 6.6 for x86_64-unknown-linux):
43 Pattern match failure in do expression at simplCore/Simplify.lhs:1540:8-21
44
45 Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
46 -}
47