From: pimjager Date: Tue, 12 Apr 2016 20:00:26 +0000 (+0200) Subject: Meer falende monads X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=a5e0570125597dc2ecd76ff7435acd92c6b7adef;p=cc1516.git Meer falende monads --- diff --git a/sem.icl b/sem.icl index 4a3fbe5..6c78854 100644 --- a/sem.icl +++ b/sem.icl @@ -29,11 +29,11 @@ instance Applicative Env where (<*>) f g = ap f g pure a = Env $ pure $ Right a -instance Alternative Env where - empty = Env $ pure $ Left (Error "Undefined error") - (<|>) f g = f >>= \ef -> g >>= \eg -> Env $ pure $ (ef <|> eg) //case ef of - //Left e = eg - //Right r = Right r +//instance Alternative Env where +// empty = Env $ pure $ Left (Error "Undefined error") +// (<|>) f g = f >>= \ef -> g >>= \eg -> Env $ pure $ case ef of +// Left e = eg +// Right r = Right r instance Monad Env where bind e f = e >>= \ee -> Env $ pure $ case ee of