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

Modulecabal-install-3.12.1.0Haskell2010

Distribution.Deprecated.ParseUtils

Utilities for parsing PackageDescription and InstalledPackageInfo.

The .cabal file format is not trivial, especially with the introduction of configurations and the section syntax that goes with that. This module has a bunch of parsing functions that is used by the .cabal parser and a couple others. It has the parsing framework code and also little parsers for many of the formats we get in various .cabal file fields, like module names, comma separated lists etc.

  • 7 types
  • 29 values
typetype LineNo = Int
#
datadata PError
#

Constructors

Instances2Eq, Show
  • Eq PErrorDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
  • Show PErrorDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
datadata PWarning
#

Constructors

Instances2Eq, Show
  • Eq PWarningDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
  • Show PWarningDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
valuelocatedErrorMsg :: PError -> (Maybe LineNo, String)
#
valuesyntaxError :: LineNo -> String -> ParseResult a
#
valuewarning :: String -> ParseResult ()
#
datadata ParseResult a
#

Constructors

  • ParseFailed PError
  • ParseOk [PWarning] a
Instances7Monad, Functor, MonadFail, Applicative, Foldable, Traversable, …
  • Monad ParseResultDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
  • Functor ParseResultDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
  • MonadFail ParseResultDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
  • Applicative ParseResultDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
  • Foldable ParseResultDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
  • Traversable ParseResultDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
  • Show a => Show (ParseResult a)Defined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
valueparseFail :: PError -> ParseResult a
#
datadata Field
#

Constructors

Instances2Eq, Show
  • Eq FieldDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
  • Show FieldDefined in cabal-install-3.12.1.0 · Distribution.Deprecated.ParseUtils
valuelineNo :: Field -> LineNo
#
datadata FieldDescr a
#

Field descriptor. The parameter a parameterizes over where the field's value is stored in.

Constructors

  • FieldDescr
    • fieldName :: String
    • fieldGet :: a -> Doc
    • fieldSet :: LineNo -> String -> a -> ParseResult a

      fieldSet n str x Parses the field value from the given input string str and stores the result in x if the parse was successful. Otherwise, reports an error on line number n.

valuereadFields :: ByteString -> ParseResult [Field]
#
valueparseSpaceList
  1. :: ReadP r a

    The parser for the stuff between commas

  2. -> ReadP r [a]
#
valueparseOptCommaList :: ReadP r a -> ReadP r [a]
#
valueshowFreeText :: String -> Doc
#

Pretty-print free-format text, ensuring that it is vertically aligned, and with blank lines replaced by dots for correct re-parsing.

typetype UnrecFieldParser a = (String, String) -> a -> Maybe a
#

The type of a function which, given a name-value pair of an unrecognized field, and the current structure being built, decides whether to incorporate the unrecognized field (by returning Just x, where x is a possibly modified version of the structure being built), or not (by returning Nothing).