summaryrefslogtreecommitdiff
path: root/events/src/Events/Spec/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'events/src/Events/Spec/Types.hs')
-rw-r--r--events/src/Events/Spec/Types.hs32
1 files changed, 32 insertions, 0 deletions
diff --git a/events/src/Events/Spec/Types.hs b/events/src/Events/Spec/Types.hs
new file mode 100644
index 0000000..665958d
--- /dev/null
+++ b/events/src/Events/Spec/Types.hs
@@ -0,0 +1,32 @@
1{-# LANGUAGE GADTs, DataKinds, PolyKinds, TypeOperators, KindSignatures, TypeFamilies, ExplicitNamespaces #-}
2
3module Events.Spec.Types
4 ( Expr(..)
5 , Val(..)
6 , Elem(..)
7 , Length(..)
8 , type (++)(..)
9 ) where
10
11data Expr :: (* -> *) -> [*] -> * -> * where
12 ELit :: Val m a -> Expr m ctx a
13 EVar :: Elem a ctx -> Expr m ctx a
14 ELam :: Expr m (arg ': ctx) res -> Expr m ctx (arg -> res)
15 EApp :: Expr m ctx (arg -> a) -> Expr m ctx arg -> Expr m ctx a
16
17type family Val m a where
18 Val m (a -> b) = Expr m '[a] b
19 Val m a = m a
20
21data Elem :: a -> [a] -> * where
22 EZ :: Elem x (x ': xs)
23 ES :: Elem x xs -> Elem x (y ': xs)
24
25data Length :: [a] -> * where
26 LZ :: Length '[]
27 LS :: Length xs -> Length (x ': xs)
28
29type family (xs :: [a]) ++ (ys :: [a]) :: [a]
30type instance '[] ++ ys = ys
31type instance (x ': xs) ++ ys = x ': (xs ++ ys)
32infixr 5 ++