summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser/should_compile/KindSigs.hs
blob: 75213abbf09790529cb84bf51224a5638c116d34 (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
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE UnboxedSums #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE TypeFamilies #-}
module KindSigs where

import Data.Kind

-- Kind annotation on type family instance equation
type family Foo a where
  Foo a = Int :: Type

-- Kind annotation on component of tuple type
type Bar a = ( Int :: Type, Bool, Maybe a :: Type )
type Bar' a = (# Int :: Type, Bool, Maybe a :: Type #)

-- Kind annotation on type of list
type Baz = [ Int :: Type ]

-- Kind annotation inside paren type
qux :: (Int :: Type) -> Bool -> (() :: Type)
qux _ _ = ()

-- Kind annotation on promoted lists and tuples
type Quux = '[ True :: Bool ]
type Quux' = [ True :: Bool, False :: Bool  ]
type Quuux b = '( [Int, Bool] :: [Type], b )

-- Kind annotation on the RHS of a type synonym
type Sarsaparilla = Int :: Type

-- Note that 'true :: Bool :: Type' won't parse - you need some parens
true :: (Bool :: Type)
true = True