No title

Anonymous Coward 2018-03-07 20:45:02.816624 UTC

1{-# LANGUAGE GADTs #-}
2{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE TypeOperators #-}
4{-# LANGUAGE PolyKinds #-}
5{-# LANGUAGE TypeFamilies #-}
6module Record where
7
8data Rec :: (u -> *) -> [u] -> * where
9 RNil :: Rec f '[]
10 RCons :: f u -> Rec f us -> Rec f (u ': us)
11
12type family Pair a where
13 Pair False = Int
14 Pair True = Bool
15
16r :: Rec Pair [False,True]
17r = RCons 3 (RCons True RNil)
18
19
20*******
21
22Record.hs:16:6:
23 Type family ‘Pair’ should have 1 argument, but has been given none
24 In the type signature for ‘r’: r :: Rec Pair '[False, True]