 an easy way to model result of parser that
-- fails. @pos@ is how many tokens (characters) has been consumed before
-- failure. @s@ is input of the parser. @ms@ is a list, collection of
-- 'Message's. See 'uneStr', 'uneCh', 'uneSpec', 'exStr', 'exCh', and
-- 'exSpec' for easy ways to create error messages.

posErr :: Int -> String -> [Message] -> Either ParseError a
posErr pos s = Left . foldr addErrorMessage (newErrorUnknown errPos)
  where errPos = updatePosString (initialPos "") (take pos s)

-- | @uneCh s@ returns message created with 'Unexpected' constructor that
-- tells the system that char @s@ is unexpected.

uneCh :: Char -> Messag
posErr :: Int -> String -> [Message] -> Either ParseError a
posErr pos s = Left . foldr addErrorMessage (newErrorUnknown errPos)
  where errPos = updatePosString (initialPos "") (take pos s)

-- | @uneCh s@ returns message created with 'Unexpected' constructor that
-- tells the system that char @s@ is unexpected.
posErr pos s = Left . foldr addErrorMessage (newErrorUnknown errPos)
  where errPos = updatePosString (initialPos "") (take pos s)

-- | @uneCh s@ returns message created with 'Unexpected' constructor that
-- tells the system that char @s@ is unexpected.