Commit b9553481 authored by Erwan Auer's avatar Erwan Auer

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

With GHC 8.6, [the option -XMonadFailDesugaring is enabled by default](https://ghc.haskell.org/trac/ghc/wiki/Migration/8.6#MonadFailDesugaringbydefault),
causing partial pattern matches in `do`-statement to desugar with the
`fail` method from the `MonadFail` class.

* src/VMMonad.hs: here.
parent 41c35a8c
Pipeline #6323 passed with stage
in 47 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