module Narc.Failure where
import Narc.Debug
import Control.Monad.Error hiding (when, join)
import Gensym
type Failure a = Either String a
fayl = Left
runError :: Either String t -> t
runError (Left e) = breakFlag $ error e
runError (Right x) = x
isError (Left x) = True
isError (Right _) = False
isSuccess (Left _) = False
isSuccess (Right _) = True
type ErrorGensym a = ErrorT String Gensym a
runErrorGensym = runError . runGensym . runErrorT
tryErrorGensym = runGensym . runErrorT
under x = either throwError return x
isErrorMSuccess = either (const False) (const True)
instance Error () where
noMsg = ()
strMsg _ = ()