mirror of
https://github.com/GaloisInc/macaw.git
synced 2024-12-28 08:34:23 +03:00
Implement NoStarIsType and MonadFail for GHC 8.6.
This commit is contained in:
parent
7a64cb614f
commit
1d7cdc87eb
@ -46,6 +46,8 @@ library
|
||||
ghc-options: -Wall
|
||||
ghc-options: -fno-warn-unticked-promoted-constructors
|
||||
ghc-prof-options: -O2 -fprof-auto-top
|
||||
if impl(ghc >= 8.6)
|
||||
default-extensions: NoStarIsType
|
||||
|
||||
test-suite macaw-x86-tests
|
||||
type: exitcode-stdio-1.0
|
||||
|
@ -38,6 +38,7 @@ module Data.Macaw.X86.ArchTypes
|
||||
) where
|
||||
|
||||
import Data.Bits
|
||||
import qualified Data.Kind as Kind
|
||||
import Data.Word(Word8)
|
||||
import Data.Macaw.CFG
|
||||
import Data.Macaw.CFG.Rewriter
|
||||
@ -877,7 +878,7 @@ x86PrimFnHasSideEffects f =
|
||||
-- X86Stmt
|
||||
|
||||
-- | An X86 specific statement.
|
||||
data X86Stmt (v :: Type -> *) where
|
||||
data X86Stmt (v :: Type -> Kind.Type) where
|
||||
WriteLoc :: !(X86PrimLoc tp) -> !(v tp) -> X86Stmt v
|
||||
|
||||
-- | Store the X87 control register in the given address.
|
||||
|
@ -61,6 +61,7 @@ module Data.Macaw.X86.Generator
|
||||
import Control.Lens
|
||||
import Control.Monad.Cont
|
||||
import Control.Monad.Except
|
||||
import Control.Monad.Fail
|
||||
import Control.Monad.Reader
|
||||
import Control.Monad.ST
|
||||
import Control.Monad.State.Strict
|
||||
@ -267,6 +268,8 @@ instance Monad (X86Generator st_s ids) where
|
||||
return v = seq v $ X86G $ return v
|
||||
(X86G m) >>= h = X86G $ m >>= \v -> seq v (unX86G (h v))
|
||||
X86G m >> X86G n = X86G $ m >> n
|
||||
|
||||
instance MonadFail (X86Generator st_s ids) where
|
||||
fail msg = seq t $ X86G $ ContT $ \_ -> throwError t
|
||||
where t = Text.pack msg
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user