--- /dev/null
+module test
+
+import StdEnv
+import Data.Maybe
+import Data.Functor
+import Control.Applicative
+
+class expr v where
+ lit :: i -> v i | toString i
+ (+.) infixl 6 :: (v i) (v i) -> v i | + i
+
+instance + (v a) | expr v & + a where
+ + l r = l +. r
+
+eval :: (Maybe a) -> Maybe a
+eval x = x
+instance expr Maybe where
+ lit i = Just i
+ +. x y = (+) <$> x <*> y
+
+:: Print a =: Print String
+print :: (Print a) -> String
+print (Print a) = a
+instance expr Print where
+ lit i = Print (toString i)
+ +. (Print l) (Print r) = Print (l +++ "+" +++ r)
+
+printEval :: (A.v: v a | expr v) -> (Maybe a, String)
+printEval f = (eval f, let (Print p) = f in p)
+
+//Mag niet
+Start :: (Maybe Int, String)
+Start = printEval (lit 4 +. lit 38)
+
+//Mag wel
+//Start = let (Print f) = lit 4 + lit 38 in f