@@ -2,9 +2,11 @@ module IRTS.Lang where
3import Core.TT
3import Core.TT
4import Control.Monad.State hiding(lift)
4import Control.Monad.State hiding(lift)
6data LVar = Loc Int | Glob Name
8data LVar = Loc Int | Glob Name
7− deriving Show
9+ deriving (Show, Eq)
9data LExp = LV LVar
11data LExp = LV LVar
10 | LApp Bool LExp [LExp] -- True = tail call
12 | LApp Bool LExp [LExp] -- True = tail call
@@ -19,7 +21,7 @@ data LExp = LV LVar
19 | LForeign FLang FType String [(FType, LExp)]
21 | LForeign FLang FType String [(FType, LExp)]
20 | LOp PrimFn [LExp]
22 | LOp PrimFn [LExp]
21 | LError String
23 | LError String
22− deriving Show
24+ deriving (Show, Eq)
24data PrimFn = LPlus | LMinus | LTimes | LDiv | LEq | LLt | LLe | LGt | LGe
26data PrimFn = LPlus | LMinus | LTimes | LDiv | LEq | LLt | LLe | LGt | LGe
25 | LFPlus | LFMinus | LFTimes | LFDiv | LFEq | LFLt | LFLe | LFGt | LFGe
27 | LFPlus | LFMinus | LFTimes | LFDiv | LFEq | LFLt | LFLe | LFGt | LFGe
@@ -35,24 +37,24 @@ data PrimFn = LPlus | LMinus | LTimes | LDiv | LEq | LLt | LLe | LGt | LGe
35 | LStrHead | LStrTail | LStrCons | LStrIndex | LStrRev
37 | LStrHead | LStrTail | LStrCons | LStrIndex | LStrRev
36 | LStdIn | LStdOut | LStdErr
38 | LStdIn | LStdOut | LStdErr
38− deriving Show
40+ deriving (Show, Eq)
40-- Supported target languages for foreign calls
42-- Supported target languages for foreign calls
42data FLang = LANG_C
44data FLang = LANG_C
43− deriving Show
45+ deriving (Show, Eq)
45data FType = FInt | FChar | FString | FUnit | FPtr | FDouble | FAny
47data FType = FInt | FChar | FString | FUnit | FPtr | FDouble | FAny
46− deriving Show
48+ deriving (Show, Eq)
48data LAlt = LConCase Int Name [Name] LExp
50data LAlt = LConCase Int Name [Name] LExp
49 | LConstCase Const LExp
51 | LConstCase Const LExp
50 | LDefaultCase LExp
52 | LDefaultCase LExp
51− deriving Show
53+ deriving (Show, Eq)
53data LDecl = LFun Name [Name] LExp -- name, arg names, definition
55data LDecl = LFun Name [Name] LExp -- name, arg names, definition
54 | LConstructor Name Int Int -- constructor name, tag, arity
56 | LConstructor Name Int Int -- constructor name, tag, arity
55− deriving Show
57+ deriving (Show, Eq)
57type LDefs = Ctxt LDecl
59type LDefs = Ctxt LDecl