fsmActions-0.1: Data/FsmActions/Error.hs
{- |
Error handling for FSMs.
-}
-- Copyright (c) 2009 Andy Gimblett - http://www.cs.swan.ac.uk/~csandy/
-- BSD Licence (see http://www.opensource.org/licenses/bsd-license.php)
module Data.FsmActions.Error (
MxError(..),
ReadMxMonad
) where
import Control.Monad.Error
-- | Errors when reading matrices from strings.
data MxError = MxError {
-- | Explanatory message
msg :: String,
-- | Offending value
value :: String
} deriving (Eq)
instance Error MxError where
noMsg = MxError "Matrix error" ""
strMsg s = MxError s ""
instance Show MxError where
show (MxError message val) = message ++ " (" ++ val ++ ")"
-- | Error monad for reading matrices from strings.
type ReadMxMonad = Either MxError