{- |
Definition of a datatype that reports on the success of a parser.
-}
module Sound.MIDI.Parser.Report where


{- |
This datatype is the result of a parser.
First it stores a sequence of warnings.
Warnings are for corruptions of the input which can be fixed.
After encountering a series of warnings,
there is finally an end,
either a successful one, with the result as @(Right result)@
or an eventual non-fixable problem indicated by @(Left errorMessage)@.
-}
data T a =
   Cons {
      forall a. T a -> [UserMessage]
warnings :: [UserMessage],
      forall a. T a -> Either UserMessage a
result   :: Either UserMessage a
   }
   deriving (Int -> T a -> ShowS
forall a. Show a => Int -> T a -> ShowS
forall a. Show a => [T a] -> ShowS
forall a. Show a => T a -> UserMessage
forall a.
(Int -> a -> ShowS)
-> (a -> UserMessage) -> ([a] -> ShowS) -> Show a
showList :: [T a] -> ShowS
$cshowList :: forall a. Show a => [T a] -> ShowS
show :: T a -> UserMessage
$cshow :: forall a. Show a => T a -> UserMessage
showsPrec :: Int -> T a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> T a -> ShowS
Show, T a -> T a -> Bool
forall a. Eq a => T a -> T a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: T a -> T a -> Bool
$c/= :: forall a. Eq a => T a -> T a -> Bool
== :: T a -> T a -> Bool
$c== :: forall a. Eq a => T a -> T a -> Bool
Eq)

type UserMessage = String