Commit 43aa87eb authored by Francis Visoiu Mistrih's avatar Francis Visoiu Mistrih Committed by Etienne Renault

Fix build issues with GHC 7.10

Functor/Applicative/Monad-Proposal break the build. This
patch follows recommandations in the following migration guide:
https://ghc.haskell.org/trac/ghc/wiki/Migration/7.10

* configure.ac: Drop support for GHC < 7.10.
* src/VMMonad.hs: here.
parent b493ecf6
......@@ -24,7 +24,7 @@ AC_INIT([HAVM], [0.26a], [projects@lrde.epita.fr])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.9.6 dist-bzip2])
HAVM_PROG([ghc], [6.4], [GHC], [Glasgow Haskell Compiler])
HAVM_PROG([ghc], [7.10], [GHC], [Glasgow Haskell Compiler])
# Pick up the right package depending on GHC's version.
dnl $actual_version is set by HAVM_PROG
case "$actual_version" in
......
......@@ -22,6 +22,7 @@ import Level (Level)
import Memory (Memory)
import Annotation (Ann)
import Opt (OptVal)
import Control.Monad (ap, liftM)
import qualified Cpu (initialize, rfetch, rstore, rpush, rpop)
import qualified Code (initialize, cload, cfind, cstore, cfetch)
import qualified Level (initialize, lfetch, lstore)
......@@ -41,11 +42,19 @@ data State =
newtype Mnd a =
Mnd (IORef State -> IO a)
instance Monad Mnd where
return x =
instance Functor Mnd where
fmap = liftM
instance Applicative Mnd where
pure x =
Mnd $ \ _ ->
return x
(<*>) = ap
instance Monad Mnd where
return = pure
(Mnd c) >>= f =
Mnd $ \ r ->
do x <- c r
......
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