summaryrefslogtreecommitdiff
path: root/tests/examples/ghc86/LiftedConstructors.hs
blob: 3e6bd0e56278a6f424cb6834c742d489cbfc0666 (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
{-# LANGUAGE DataKinds, TypeOperators, GADTs #-}

give :: b -> Pattern '[b] a
give b = Pattern (const (Just $ oneT b))


pfail :: Pattern '[] a
pfail = is (const False)

(/\) :: Pattern vs1 a -> Pattern vs2 a -> Pattern (vs1 :++: vs2) a
(/\) = mk2 (\a -> Just (a,a))

data Pattern :: [Type] -> Type where
  Nil :: Pattern '[]
  Cons :: Maybe h -> Pattern t -> Pattern (h ': t)

type Pos = '("vpos", V3 GLfloat)
type Tag = '("tagByte", V1 Word8)

-- | Alias for the 'In' type from the 'Direction' kind, allows users to write
-- the 'BroadcastChan In a' type without enabling DataKinds.
type In = 'In
-- | Alias for the 'Out' type from the 'Direction' kind, allows users to write
-- the 'BroadcastChan Out a' type without enabling DataKinds.
type Out = 'Out