From 0731c5c6863277778349752bd88378f4ab7a3412 Mon Sep 17 00:00:00 2001 From: Kevin Quick Date: Tue, 20 Nov 2018 23:37:21 +0000 Subject: [PATCH] Add MonadFail for Generator for GHC 8.6 --- macaw-semmc/src/Data/Macaw/SemMC/Generator.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/macaw-semmc/src/Data/Macaw/SemMC/Generator.hs b/macaw-semmc/src/Data/Macaw/SemMC/Generator.hs index d7c4aaaa..7db62406 100644 --- a/macaw-semmc/src/Data/Macaw/SemMC/Generator.hs +++ b/macaw-semmc/src/Data/Macaw/SemMC/Generator.hs @@ -52,6 +52,7 @@ import GHC.TypeLits import Control.Lens import qualified Control.Monad.Cont as Ct import qualified Control.Monad.Except as ET +import Control.Monad.Fail import qualified Control.Monad.Reader as Rd import Control.Monad.ST ( ST ) import qualified Control.Monad.State.Strict as St @@ -248,6 +249,9 @@ instance St.MonadState (GenState arch ids s) (Generator arch ids s) where instance ET.MonadError GeneratorError (Generator arch ids s) where throwError e = Generator (Ct.ContT (\_ -> ET.throwError e)) +instance MonadFail (Generator arch ids s) where + fail err = ET.throwError $ GeneratorMessage $ show err + -- | The type of continuations provided by 'shiftGen' type GenCont arch ids s a = a -> GenState arch ids s -> ET.ExceptT GeneratorError (ST s) (GenResult arch ids)