diff --git a/x86/macaw-x86.cabal b/x86/macaw-x86.cabal index a4904a7c..186f0993 100644 --- a/x86/macaw-x86.cabal +++ b/x86/macaw-x86.cabal @@ -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 diff --git a/x86/src/Data/Macaw/X86/ArchTypes.hs b/x86/src/Data/Macaw/X86/ArchTypes.hs index 8889687e..81b00367 100644 --- a/x86/src/Data/Macaw/X86/ArchTypes.hs +++ b/x86/src/Data/Macaw/X86/ArchTypes.hs @@ -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. diff --git a/x86/src/Data/Macaw/X86/Generator.hs b/x86/src/Data/Macaw/X86/Generator.hs index 80337ac5..109f3a65 100644 --- a/x86/src/Data/Macaw/X86/Generator.hs +++ b/x86/src/Data/Macaw/X86/Generator.hs @@ -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