diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-31 00:23:23 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-31 00:23:23 +0200 |
commit | d22086666632b707aa210f20ecf10a8cd4e6d4fe (patch) | |
tree | dd561d380898dfb0a0e8fc6d98249c965c19c221 /events/src/Events/Spec/Types.hs | |
parent | 41d0a0c8c3a66ce48756ad8c2ab0ea87933047c9 (diff) | |
download | events-d22086666632b707aa210f20ecf10a8cd4e6d4fe.tar events-d22086666632b707aa210f20ecf10a8cd4e6d4fe.tar.gz events-d22086666632b707aa210f20ecf10a8cd4e6d4fe.tar.bz2 events-d22086666632b707aa210f20ecf10a8cd4e6d4fe.tar.xz events-d22086666632b707aa210f20ecf10a8cd4e6d4fe.zip |
Lambda calculus for computing events at runtime
Diffstat (limited to 'events/src/Events/Spec/Types.hs')
-rw-r--r-- | events/src/Events/Spec/Types.hs | 32 |
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 | |||
3 | module Events.Spec.Types | ||
4 | ( Expr(..) | ||
5 | , Val(..) | ||
6 | , Elem(..) | ||
7 | , Length(..) | ||
8 | , type (++)(..) | ||
9 | ) where | ||
10 | |||
11 | data 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 | |||
17 | type family Val m a where | ||
18 | Val m (a -> b) = Expr m '[a] b | ||
19 | Val m a = m a | ||
20 | |||
21 | data Elem :: a -> [a] -> * where | ||
22 | EZ :: Elem x (x ': xs) | ||
23 | ES :: Elem x xs -> Elem x (y ': xs) | ||
24 | |||
25 | data Length :: [a] -> * where | ||
26 | LZ :: Length '[] | ||
27 | LS :: Length xs -> Length (x ': xs) | ||
28 | |||
29 | type family (xs :: [a]) ++ (ys :: [a]) :: [a] | ||
30 | type instance '[] ++ ys = ys | ||
31 | type instance (x ': xs) ++ ys = x ': (xs ++ ys) | ||
32 | infixr 5 ++ | ||