I'm still new to Haskell. Whats the best way to distinguish between errors?
Currently I'm using the
maybe monad but it can only 'represent one state of error'.
The following code snippet will put my question into context.
pulOh :: Seq -- input X O sequence -> Int -- split point real index -> Maybe Seq pulOh xs n = case (\(f,l)->(tlTrn f, hdTrn l)) (splSq xs n) of -- split and process at index (Nothing, _) -> Nothing -- first failed (_, Nothing) -> Nothing -- last failed (Just f,Just l) -> Just (f ++ l) -- both parts passed
I would like the result to be able to distinguish if the call fails for
snd. Short-circuiting the case of both failing to