1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Generalize eliminateFailures to MonadFail.

This commit is contained in:
Patrick Thomson 2019-12-05 15:15:15 -05:00
parent 615931890b
commit 7978318d6b

View File

@ -12,6 +12,7 @@ module Language.Python.Failure
import Prelude hiding (fail)
import Control.Effect.Carrier
import Control.Monad.Fail
import Data.Coerce
import Data.Kind
import Syntax.Module
@ -46,7 +47,7 @@ unimplemented x = send . Unimplemented $ x
invariantViolated :: (Member Failure sig, Carrier sig m) => String -> m a
invariantViolated = send . InvariantViolated
eliminateFailures :: (HTraversable sig, RightModule sig)
eliminateFailures :: (MonadFail m, HTraversable sig, RightModule sig)
=> Term (Failure :+: sig) a
-> Either String (Term sig a)
eliminateFailures = Syntax.Term.handle (pure . pure) (Left . show)
eliminateFailures = Syntax.Term.handle (pure . pure) (fail . show)