summaryrefslogtreecommitdiff
path: root/src/Interpreter/Rep.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Interpreter/Rep.hs')
-rw-r--r--src/Interpreter/Rep.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Interpreter/Rep.hs b/src/Interpreter/Rep.hs
new file mode 100644
index 0000000..1ded773
--- /dev/null
+++ b/src/Interpreter/Rep.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE TypeFamilies #-}
+module Interpreter.Rep where
+
+import GHC.TypeError
+
+import Array
+import AST
+
+
+type family Rep t where
+ Rep TNil = ()
+ Rep (TPair a b) = (Rep a, Rep b)
+ Rep (TEither a b) = Either (Rep a) (Rep b)
+ Rep (TArr n t) = Array n (Rep t)
+ Rep (TScal sty) = ScalRep sty
+ Rep (TAccum t) = TypeError (Text "Accumulator in Rep")