X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=expr%2Fshallow.icl;fp=expr%2Fshallow.icl;h=0000000000000000000000000000000000000000;hb=4b62b5d397d86147e393c05b3083af74a3a0c4af;hp=71a3abc22d94d1ff0008c473eab0a699494cca03;hpb=e5305ee9d4290e1aa803a2e62a14f32e5cd29782;p=clean-tests.git diff --git a/expr/shallow.icl b/expr/shallow.icl deleted file mode 100644 index 71a3abc..0000000 --- a/expr/shallow.icl +++ /dev/null @@ -1,37 +0,0 @@ -module shallow - -import StdEnv -import Data.Func -import Data.Functor -import Data.Either -import Data.List -import Data.Maybe -import Control.Applicative -import Control.Monad - -:: Expr :== - ([(String, Int)] -> Either String Int //Evaluator - , String) //Printer - -lit :: Int -> Expr -lit i = (const $ pure i, toString i) - -var :: String -> Expr -var s = - ( maybe (Left $ "Undefined variable " +++ s) Right o lookup s - , s - ) - -(+.) infixl 6 :: Expr Expr -> Expr -(+.) (ea, pa) (eb, pb) = - ( \s->liftM2 (+) (ea s) (eb s) - , pa +++ " + " +++ pb - ) - -print :: Expr -> String -print (_, p) = p - -eval :: Expr [(String, Int)]-> Either String Int -eval (e, _) s = e s - -Start = eval (lit 5 +. lit 37) []