haskell-src-1.0.4.2: Support for manipulating Haskell source code

Copyright | (c) Simon Marlow Sven Panne 1997-2000
License | BSD-style (see the file libraries/base/LICENSE)
Maintainer | libraries@haskell.org
Stability | stable
Portability | portable
Safe Haskell | None
Language | Haskell98

Language.Haskell.Parser

Description

Haskell parser.

Synopsis

- parseModule :: String -> ParseResult HsModule
- parseModuleWithMode :: ParseMode -> String -> ParseResult HsModule
- data ParseMode = ParseMode {
  - parseFilename :: String
  }
- defaultParseMode :: ParseMode
- data ParseResult a
  - = ParseOk a
  - | ParseFailed SrcLoc String

# Documentation

parseModule :: String -> ParseResult HsModule Source #

Parse of a string, which should contain a complete Haskell 98 module.

parseModuleWithMode :: ParseMode -> String -> ParseResult HsModule Source #

Parse of a string, which should contain a complete Haskell 98 module.

data ParseMode Source #

Static parameters governing a parse. More to come later, e.g. literate mode, language extensions.

Constructors

ParseMode |

Fields

- parseFilename :: String

  original name of the file being parsed

defaultParseMode :: ParseMode Source #

Default parameters for a parse, currently just a marker for an unknown filename.

data ParseResult a Source #

The result of a parse.

Constructors

ParseOk a | The parse succeeded, yielding a value.
ParseFailed SrcLoc String | The parse failed at the specified source location, with an error message.

#### Instances

Instances details

Applicative ParseResult Source # |
Instance details Defined in Language.Haskell.ParseMonad Methods pure :: a -> ParseResult a Source # (<*>) :: ParseResult (a -> b) -> ParseResult a -> ParseResult b Source # liftA2 :: (a -> b -> c) -> ParseResult a -> ParseResult b -> ParseResult c Source # (*>) :: ParseResult a -> ParseResult b -> ParseResult b Source # (<*) :: ParseResult a -> ParseResult b -> ParseResult a Source #
Functor ParseResult Source # |
Instance details Defined in Language.Haskell.ParseMonad Methods fmap :: (a -> b) -> ParseResult a -> ParseResult b Source # (<$) :: a -> ParseResult b -> ParseResult a Source #
Monad ParseResult Source # |
Instance details Defined in Language.Haskell.ParseMonad Methods (>>=) :: ParseResult a -> (a -> ParseResult b) -> ParseResult b Source # (>>) :: ParseResult a -> ParseResult b -> ParseResult b Source # return :: a -> ParseResult a Source #
Monoid m => Monoid (ParseResult m) Source # |
Instance details Defined in Language.Haskell.ParseMonad Methods mempty :: ParseResult m Source # mappend :: ParseResult m -> ParseResult m -> ParseResult m Source # mconcat :: [ParseResult m] -> ParseResult m Source #
Monoid m => Semigroup (ParseResult m) Source # | Since: 1.0.3.0
Instance details Defined in Language.Haskell.ParseMonad Methods (<>) :: ParseResult m -> ParseResult m -> ParseResult m Source # sconcat :: NonEmpty (ParseResult m) -> ParseResult m Source # stimes :: Integral b => b -> ParseResult m -> ParseResult m Source #
Show a => Show (ParseResult a) Source # |
Instance details Defined in Language.Haskell.ParseMonad Methods showsPrec :: Int -> ParseResult a -> ShowS Source # show :: ParseResult a -> String Source # showList :: [ParseResult a] -> ShowS Source #