Commit c52e1b88 authored by Etienne Renault's avatar Etienne Renault

Merge branch 'ea/fix-monad-fail' into 'master'

vmmonad: added Monad.Fail compliance for Monad Mnd solving #5

See merge request !2
parents 41c35a8c b9553481
Pipeline #6328 passed with stage
in 2 minutes and 30 seconds
......@@ -24,6 +24,7 @@ import Memory (Memory)
import Annotation (Ann)
import Opt (OptVal)
import Control.Monad (ap, liftM)
import qualified Control.Monad.Fail as Fail
import qualified Cpu (initialize, rfetch, rstore, rpush, rpop)
import qualified Code (initialize, cload, cfind, cstore, cfetch)
import qualified Level (initialize, lfetch, lstore)
......@@ -61,6 +62,11 @@ instance Monad Mnd where
do x <- c r
case f x of (Mnd c') -> c' r
fail = Fail.fail
instance Fail.MonadFail Mnd where
fail = error "fail: invalid pattern matching"
run :: Mnd a -> IO a
run (Mnd c) =
do m <- Memory.initialize 65536 16384
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment