-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A simplified view on the haskell-src-exts AST
--   
--   This package provides a shim for haskell-src-exts (HSE), exposing the
--   same AST but without annotations, using ghc's pattern synonyms.
--   
--   See README.md for further information and compatibility
--   considerations.
@package haskell-src-exts-simple
@version 1.20.0.0


-- | This module reexports <a>Language.Haskell.Exts.Build</a>.
module Language.Haskell.Exts.Simple.Build


-- | This module reexports <a>Language.Haskell.Exts.Extension</a>.
module Language.Haskell.Exts.Simple.Extension


-- | This module reexports <a>Language.Haskell.Exts.Pretty</a>.
module Language.Haskell.Exts.Simple.Pretty


-- | This module reexports a simplified view on
--   <a>Language.Haskell.Exts.Syntax</a>. The idea is to expose datatypes
--   like
--   
--   <pre>
--   data Name l = Ident l String | Symbol l String
--   </pre>
--   
--   using ghc's pattern synonyms:
--   
--   <pre>
--   type Name = H.Name ()
--   pattern Ident a = H.Ident () a
--   pattern Symbol a = H.Symbol () a
--   </pre>
--   
--   This works nicely for all datatypes with two exception:
--   
--   <ul>
--   <li><a>ImportDecl</a> has a record constructor. Record type synonyms
--   are only supported ghc-8.0 and later, so for ghc-7.10 and earlier, the
--   constructor is exported as a plain constructor, and the record fields
--   as function.</li>
--   <li><a>Literal</a> has constructors with an extra <a>String</a>
--   argument that is not used by <a>Pretty</a>. This module uses
--   explicitly bidirectional pattern synonyms to support this type, but
--   support for that is only available in ghc-7.10 and later.</li>
--   </ul>
--   
--   <b>IMPORTANT</b>: if you require compatiblity with ghc 7.8, you should
--   use the functions <a>charL</a>, <a>stringL</a> etc. for constructing
--   <a>Literal</a> values!
module Language.Haskell.Exts.Simple.Syntax
type Alt = Alt ()
type FieldUpdate = FieldUpdate ()
type QualStmt = QualStmt ()
type Stmt = Stmt ()
type PatField = PatField ()
type RPat = RPat ()
type RPatOp = RPatOp ()
type PXAttr = PXAttr ()
type Pat = Pat ()
type WarningText = WarningText ()
type RuleVar = RuleVar ()
type Rule = Rule ()
type Activation = Activation ()
type Overlap = Overlap ()
type ModulePragma = ModulePragma ()
type CallConv = CallConv ()
type Safety = Safety ()
type Splice = Splice ()
type Bracket = Bracket ()
type XAttr = XAttr ()
type XName = XName ()
type Exp = Exp ()
type Sign = Sign ()

-- | Beware that the constructors only work in a pattern context in
--   ghc-7.8, because that version does not support explicitly
--   bidirectional pattern synonyms.
--   
--   For code that needs to work with ghc-7.8, we provide functions
--   <a>charL</a>, <a>stringL</a>, <a>intL</a>, <a>fracL</a>, etc. for
--   constructing <a>Literal</a> values.
type Literal = Literal ()
type Asst = Asst ()
type Context = Context ()
type FunDep = FunDep ()
type Kind = Kind ()
type TyVarBind = TyVarBind ()
type Promoted = Promoted ()
type MaybePromotedName = MaybePromotedName ()
type Type = Type ()
type GuardedRhs = GuardedRhs ()
type Rhs = Rhs ()
type Unpackedness = Unpackedness ()
type BangType = BangType ()
type InstDecl = InstDecl ()
type ClassDecl = ClassDecl ()
type GadtDecl = GadtDecl ()
type FieldDecl = FieldDecl ()
type ConDecl = ConDecl ()
type QualConDecl = QualConDecl ()
type Match = Match ()
type IPBind = IPBind ()
type Binds = Binds ()
type DerivStrategy = DerivStrategy ()
type Deriving = Deriving ()
type InstHead = InstHead ()
type InstRule = InstRule ()
type DeclHead = DeclHead ()
type ResultSig = ResultSig ()
type InjectivityInfo = InjectivityInfo ()
type DataOrNew = DataOrNew ()
type Role = Role ()
type BooleanFormula = BooleanFormula ()
type Annotation = Annotation ()
type TypeEqn = TypeEqn ()
type PatternSynDirection = PatternSynDirection ()
type Decl = Decl ()
type Assoc = Assoc ()
type ImportSpec = ImportSpec ()
type ImportSpecList = ImportSpecList ()
type ImportDecl = ImportDecl ()
type Namespace = Namespace ()
type EWildcard = EWildcard ()
type ExportSpec = ExportSpec ()
type ExportSpecList = ExportSpecList ()
type ModuleHead = ModuleHead ()
type Module = Module ()
type CName = CName ()
type Op = Op ()
type QOp = QOp ()
type IPName = IPName ()
type Name = Name ()
type QName = QName ()
type SpecialCon = SpecialCon ()
type ModuleName = ModuleName ()

-- | Note, this is originally a record constructor, and we use a pattern
--   record synonym for ghc-8.0. But for earlier ghc versions,
--   <a>ImportDecl</a> is a plain pattern synonym, and the selectors are
--   exported as functions.
importModule :: ImportDecl -> ModuleName ()
importQualified :: ImportDecl -> Bool
importSrc :: ImportDecl -> Bool
importSafe :: ImportDecl -> Bool
importPkg :: ImportDecl -> Maybe String
importAs :: ImportDecl -> Maybe ModuleName ()
importSpecs :: ImportDecl -> Maybe ImportSpecList ()
charL :: Char -> Literal
stringL :: String -> Literal
intL :: Integer -> Literal
fracL :: Rational -> Literal
primIntL :: Integer -> Literal
primWordL :: Integer -> Literal
primFloatL :: Rational -> Literal
primDoubleL :: Rational -> Literal
primCharL :: Char -> Literal
primStringL :: String -> Literal
prelude_mod :: ModuleName
main_mod :: ModuleName
main_name :: Name
unit_con_name :: QName
tuple_con_name :: Boxed -> Int -> QName
list_cons_name :: QName
unboxed_singleton_con_name :: QName
unit_con :: Exp
tuple_con :: Boxed -> Int -> Exp
unboxed_singleton_con :: Exp
as_name :: Name
qualified_name :: Name
hiding_name :: Name
minus_name :: Name
bang_name :: Name
dot_name :: Name
star_name :: Name
hole_name :: QName
export_name :: Name
safe_name :: Name
unsafe_name :: Name
interruptible_name :: Name
threadsafe_name :: Name
stdcall_name :: Name
ccall_name :: Name
cplusplus_name :: Name
dotnet_name :: Name
jvm_name :: Name
js_name :: Name
javascript_name :: Name
capi_name :: Name
forall_name :: Name
family_name :: Name
role_name :: Name
stock_name :: Name
anyclass_name :: Name
unit_tycon_name :: QName
fun_tycon_name :: QName
list_tycon_name :: QName
unboxed_singleton_tycon_name :: QName
tuple_tycon_name :: Boxed -> Int -> QName
unit_tycon :: Type
fun_tycon :: Type
list_tycon :: Type
unboxed_singleton_tycon :: Type
tuple_tycon :: Boxed -> Int -> Type

-- | Flag denoting whether a tuple is boxed or unboxed.
data Boxed
Boxed :: Boxed
Unboxed :: Boxed

-- | Recognised tools for OPTIONS pragmas.
data Tool
GHC :: Tool
HUGS :: Tool
NHC98 :: Tool
YHC :: Tool
HADDOCK :: Tool
UnknownTool :: String -> Tool


-- | This module partially reexports <a>Language.Haskell.Exts.Parser</a>
--   with adaptations.
--   
--   <b>IMPORTANT</b>: if you require compatiblity with ghc 7.8, you should
--   use the function <a>listOf</a> for constructing <a>ListOf</a> values!
module Language.Haskell.Exts.Simple.Parser
type ModuleHeadAndImports = ModuleHeadAndImports ()
type PragmasAndModuleHead = PragmasAndModuleHead ()
type PragmasAndModuleName = PragmasAndModuleName ()

-- | Beware that the <a>ListOf</a> constructor only works in a pattern
--   context in ghc-7.8, because that version does not support explicitly
--   bidirectional pattern synonyms.
--   
--   For code that needs to work with ghc-7.8, we provide the <a>listOf</a>
--   function constructing <a>ListOf</a> values.
type ListOf = ListOf
listOf :: [a] -> ListOf a
parse :: (Parseable (ast SrcSpanInfo), Functor ast) => String -> ParseResult (ast ())
parseWithMode :: (Parseable (ast SrcSpanInfo), Functor ast) => ParseMode -> String -> ParseResult (ast ())
parseModule :: String -> ParseResult Module
parseModuleWithMode :: ParseMode -> String -> ParseResult Module
parseExp :: String -> ParseResult Exp
parseExpWithMode :: ParseMode -> String -> ParseResult Exp
parseStmt :: String -> ParseResult Stmt
parseStmtWithMode :: ParseMode -> String -> ParseResult Stmt
parsePat :: String -> ParseResult Pat
parsePatWithMode :: ParseMode -> String -> ParseResult Pat
parseDecl :: String -> ParseResult Decl
parseDeclWithMode :: ParseMode -> String -> ParseResult Decl
parseType :: String -> ParseResult Type
parseTypeWithMode :: ParseMode -> String -> ParseResult Type
parseImportDecl :: String -> ParseResult ImportDecl
parseImportDeclWithMode :: ParseMode -> String -> ParseResult ImportDecl
getTopPragmas :: String -> ParseResult [ModulePragma]
unListOf :: () => ListOf a -> [a]

-- | Instances of <a>Parseable</a> for <tt>NonGreedy a</tt> will only
--   consume the input until <tt>a</tt> is fully parsed. This means that
--   parse errors that come later in the input will be ignored. It's also
--   more efficient, as it's fully lazy in the remainder of the input:
--   
--   <pre>
--   &gt;&gt;&gt; parse (unlines ("module A where" : "main =" : repeat "blah")) :: ParseResult PragmasAndModuleHead
--   ParseOk (NonGreedy {unNonGreedy = PragmasAndModuleHead [] (ModuleName "A",Nothing,Nothing)})
--   </pre>
--   
--   (this example uses the simplified AST)
newtype NonGreedy a
NonGreedy :: a -> NonGreedy a
[unNonGreedy] :: NonGreedy a -> a

-- | Default parameters for a parse. The default is an unknown filename, no
--   extensions (i.e. Haskell 98), don't ignore LANGUAGE pragmas, do ignore
--   LINE pragmas, and be aware of fixities from the <tt>Prelude</tt>.
defaultParseMode :: ParseMode

-- | Retrieve the result of a successful parse, throwing an error if the
--   parse is actually not successful.
fromParseResult :: () => ParseResult a -> a

-- | Class providing function for parsing at many different types.
--   
--   Note that for convenience of implementation, the default methods have
--   definitions equivalent to <a>undefined</a>. The minimal definition is
--   all of the visible methods.
class Parseable ast

-- | The result of a parse.
data ParseResult a

-- | The parse succeeded, yielding a value.
ParseOk :: a -> ParseResult a

-- | The parse failed at the specified source location, with an error
--   message.
ParseFailed :: SrcLoc -> String -> ParseResult a

-- | Static parameters governing a parse. Note that the various parse
--   functions in <a>Language.Haskell.Exts.Parser</a> never look at
--   LANGUAGE pragmas, regardless of what the
--   <tt>ignoreLanguagePragmas</tt> flag is set to. Only the various
--   <tt>parseFile</tt> functions in <a>Language.Haskell.Exts</a> will act
--   on it, when set to <a>False</a>.
data ParseMode
ParseMode :: String -> Language -> [Extension] -> Bool -> Bool -> Maybe [Fixity] -> Bool -> ParseMode

-- | original name of the file being parsed
[parseFilename] :: ParseMode -> String

-- | base language (e.g. Haskell98, Haskell2010)
[baseLanguage] :: ParseMode -> Language

-- | list of extensions enabled for parsing
[extensions] :: ParseMode -> [Extension]

-- | if <a>True</a>, the parser won't care about further extensions in
--   LANGUAGE pragmas in source files
[ignoreLanguagePragmas] :: ParseMode -> Bool

-- | if <a>True</a>, the parser won't read line position information from
--   LINE pragmas in source files
[ignoreLinePragmas] :: ParseMode -> Bool

-- | list of fixities to be aware of
[fixities] :: ParseMode -> Maybe [Fixity]

-- | Checks whether functions have a consistent arity
[ignoreFunctionArity] :: ParseMode -> Bool


-- | This module partially reexports <a>Language.Haskell.Exts.Fixity</a>,
--   adapting <tt>applyFixityies</tt>.
module Language.Haskell.Exts.Simple.Fixity
applyFixities :: (AppFixity ast, Functor ast, Monad m) => [Fixity] -> ast () -> m (ast ())
infix_ :: Int -> [String] -> [Fixity]
infixl_ :: Int -> [String] -> [Fixity]
infixr_ :: Int -> [String] -> [Fixity]

-- | All fixities defined in the base package.
--   
--   Note that the <tt>+++</tt> operator appears in both Control.Arrows and
--   Text.ParserCombinators.ReadP. The listed precedence for <tt>+++</tt>
--   in this list is that of Control.Arrows.
baseFixities :: [Fixity]

-- | All fixities defined in the Prelude.
preludeFixities :: [Fixity]

-- | Operator fixities are represented by their associativity (left, right
--   or none) and their precedence (0-9).
data Fixity
Fixity :: Assoc () -> Int -> QName () -> Fixity

-- | All AST elements that may include expressions which in turn may need
--   fixity tweaking will be instances of this class.
class AppFixity (ast :: * -> *)


-- | This module exports all relevant modules of the
--   haskell-src-exts-simple package.
--   
--   The most important module is
--   <a>Language.Haskell.Exts.Simple.Syntax</a>.
module Language.Haskell.Exts.Simple
parseFile :: FilePath -> IO (ParseResult Module)
parseFileWithExts :: [Extension] -> FilePath -> IO (ParseResult Module)
parseFileWithMode :: ParseMode -> FilePath -> IO (ParseResult Module)
parseFileContents :: String -> ParseResult Module
parseFileContentsWithExts :: [Extension] -> String -> ParseResult Module
parseFileContentsWithMode :: ParseMode -> String -> ParseResult Module
