From 302891ef956bd735780714742850947bf7588ce5 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Wed, 13 Apr 2016 22:13:38 +0200 Subject: [PATCH] added type to sem.icl =/= --- AST.dcl | 1 - AST.icl | 3 +-- sem.icl | 8 +++++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/AST.dcl b/AST.dcl index cb2e5b7..3a61b54 100644 --- a/AST.dcl +++ b/AST.dcl @@ -45,5 +45,4 @@ instance toString Type instance toString Pos instance toString Op2 instance == Op2 -instance == Type instance toString FieldSelector diff --git a/AST.icl b/AST.icl index 5173c4c..7b93acb 100644 --- a/AST.icl +++ b/AST.icl @@ -111,6 +111,5 @@ instance print Expr where print (EmptyListExpr _) = ["[]"] print (TupleExpr _ (e1, e2)) = ["(":print e1] ++ [",":print e2] ++ [")"] -derive gEq Op2, Type +derive gEq Op2 instance == Op2 where (==) o1 o2 = gEq{|*|} o1 o2 -instance == Type where (==) o1 o2 = gEq{|*|} o1 o2 diff --git a/sem.icl b/sem.icl index 21fd235..66d9024 100644 --- a/sem.icl +++ b/sem.icl @@ -18,6 +18,7 @@ import StdString import StdTuple import StdList import StdBool +import GenEq from Text import class Text(concat), instance Text String @@ -32,7 +33,7 @@ from parse import :: ParserOutput, :: Error instance MonadTrans (StateT Gamma) where liftT m = StateT \s-> m >>= \a-> return (a, s) -get = gets id +get :== gets id sem :: AST -> SemOutput sem (AST vd fd) = case runStateT m ('Map'.newMap, getRandomStream 1) of @@ -276,3 +277,8 @@ saveGamma = get restoreGamma :: Gamma -> Env Void restoreGamma (oldstate, _) = gets snd >>= \newr->put (oldstate, newr) + +derive gEq Type +instance == Type where + (==) (IdType _) (IdType _) = True + (==) o1 o2 = gEq{|*|} o1 o2 -- 2.20.1