HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleparsec-3.1.18.0Haskell2010

Text.Parsec.Error

Parse errors

  • 2 types
  • 11 values
  • Packageparsec-3.1.18.0
  • Exports13
  • LanguageHaskell2010
  • LicenceBSD-2-Clause
  • SourceError.hs
datadata Message
#

This abstract data type represents parse error messages. There are four kinds of messages:

 data Message = SysUnExpect String
              | UnExpect String
              | Expect String
              | Message String

The fine distinction between different kinds of parse errors allows the system to generate quite good error messages for the user. It also allows error messages that are formatted in different languages. Each kind of message is generated by different combinators:

  • A SysUnExpect message is automatically generated by the Text.Parsec.Combinator.satisfy combinator. The argument is the unexpected input.

  • A UnExpect message is generated by the unexpected combinator. The argument describes the unexpected item.

  • A Expect message is generated by the <?> combinator. The argument describes the expected item.

  • A Message message is generated by the fail combinator. The argument is some general parser message.

Instances3Enum, Eq, Ord
  • Enum MessageDefined in parsec-3.1.18.0 · Text.Parsec.Error
  • Eq MessageDefined in parsec-3.1.18.0 · Text.Parsec.Error
  • Ord MessageDefined in parsec-3.1.18.0 · Text.Parsec.Error
datadata ParseError
#

The abstract data type ParseError represents parse errors. It provides the source position (SourcePos) of the error and a list of error messages (Message). A ParseError can be returned by the function parse. ParseError is an instance of the Show and Eq classes.

Instances3Eq, Show, Exception