Update Trac ticket URLs to point to GitLab
[ghc.git] / testsuite / tests / gadt / gadt-fd.hs
1 {-# LANGUAGE GADTs #-}
2 {-# LANGUAGE MultiParamTypeClasses #-}
3 {-# LANGUAGE KindSignatures #-}
4 {-# LANGUAGE FlexibleInstances #-}
5 {-# LANGUAGE FunctionalDependencies #-}
6 {-# LANGUAGE UndecidableInstances #-}
7
8 -- #345
9
10 module ShouldCompile where
11
12 data Succ n
13 data Zero
14
15 class Plus x y z | x y -> z
16 instance Plus Zero x x
17 instance Plus x y z => Plus (Succ x) y (Succ z)
18
19 infixr 5 :::
20
21 data List :: * -> * -> * where
22 Nil :: List a Zero
23 (:::) :: a -> List a n -> List a (Succ n)
24
25 append :: Plus x y z => List a x -> List a y -> List a z
26 append Nil ys = ys
27 append (x ::: xs) ys = x ::: append xs ys
28