aboutsummaryrefslogtreecommitdiff
path: root/src/Assignment.hs
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-06-03 12:02:31 +0200
committerCharles <sircharlesaze@gmail.com>2020-06-03 12:02:31 +0200
commit99e5658feb48f15f85eaf9680affea2f490459bb (patch)
tree61fa812185892845b36792960435f79e0535043f /src/Assignment.hs
parente8e86cea2bffe23961f0a1bea8ee770343894858 (diff)
downloadcomputorv2-99e5658feb48f15f85eaf9680affea2f490459bb.tar.gz
computorv2-99e5658feb48f15f85eaf9680affea2f490459bb.tar.bz2
computorv2-99e5658feb48f15f85eaf9680affea2f490459bb.zip
Refactoring parsing, Fixing builtin, rewrite everything else
Diffstat (limited to 'src/Assignment.hs')
-rw-r--r--src/Assignment.hs48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/Assignment.hs b/src/Assignment.hs
deleted file mode 100644
index 2dc7aef..0000000
--- a/src/Assignment.hs
+++ /dev/null
@@ -1,48 +0,0 @@
-module Assignment where
-
-import Data.List
-import qualified Expr as E
-
-data Assignment
- = Variable String E.Expr
- | Function String String E.Expr
-
-instance Eq Assignment where
- (Variable n1 _) == (Variable n2 _) = n1 == n2
- (Function n1 _ _) == (Function n2 _ _) = n1 == n2
- _ == _ = False
-
-name :: Assignment -> String
-name (Variable n _) = n
-name (Function n _ _) = n
-
--- data Context a = Context { vars :: [Assignment], payload :: a }
-type Context = [Assignment]
-
--- instance Functor Context where
--- fmap f (Context as x) = Context as (f x)
---
--- instance Applicative Context where
--- pure x = Context [] x
--- (Context a1 f) <*> (Context a2 x) = Context (a1 `union` a2) (f x)
---
--- instance Monad Context where
--- return = pure
--- (Context a1 x) >>= f = Context (vars res `union` a1) (payload res)
--- where res = f x
-
-
-update :: Context -> Assignment -> Context
-update context a
- | a `elem` context = map replaceIf context
- | otherwise = a:context
- where replaceIf a' = if a' == a then a else a'
-
-get :: Context -> String -> Maybe Assignment
-get context n = case found of [] -> Nothing
- [a] -> Just a
- where found = filter (\a -> name a == n) context
-
-instance Show Assignment where
- show (Variable name e) = name ++ " = " ++ show e
- show (Function name arg e) = name ++ "(" ++ arg ++ ") = " ++ show e