ghc-7.10.2: The GHC API

Safe HaskellNone
LanguageHaskell2010

RdrHsSyn

Synopsis

Documentation

mkHsOpApp :: LHsExpr id -> id -> LHsExpr id -> HsExpr id Source

mkTyClD :: LTyClDecl n -> LHsDecl n Source

mkClassDecl builds a RdrClassDecl, filling in the names for tycon and datacon by deriving them from the name of the class. We fill in the names for the tycon and datacon corresponding to the class, by deriving them from the name of the class itself. This saves recording the names in the interface file (which would be equally good).

cvTopDecls :: OrdList (LHsDecl RdrName) -> [LHsDecl RdrName] Source

Function definitions are restructured here. Each is assumed to be recursive initially, and non recursive definitions are discovered by the dependency analyser.

checkPartialTypeSignature :: LHsType RdrName -> P (LHsType RdrName) Source

Check the validity of a partial type signature. We check the following things:

  • There should only be one extra-constraints wildcard in the type signature, i.e. the _ in _ => a -> String. This would be invalid: (Eq a, _) => a -> (Num a, _) => a -> Bool. Extra-constraints wildcards are only allowed in the top-level context.
  • Named extra-constraints wildcards aren't allowed, e.g. invalid: (Show a, _x) => a -> String.
  • There is only one extra-constraints wildcard in the context and it must come last, e.g. invalid: (_, Show a) => a -> String or (_, Show a, _) => a -> String.
  • There should be no unnamed wildcards in the context.
  • Named wildcards occurring in the context must also occur in the monotype.

An error is reported when an invalid wildcard is found.

checkNoPartialType :: SDoc -> LHsType RdrName -> P () Source

Check that the given type does not contain wildcards, and is thus not a partial type. If it contains wildcards, report an error with the given message.

checkValidPatSynSig :: Sig RdrName -> P (Sig RdrName) Source

Check that the pattern synonym type signature does not contain wildcards.

checkValidDefaults :: [LHsType RdrName] -> P (DefaultDecl RdrName) Source

Check that the default declarations do not contain wildcards in their types, which we do not want as the types in the default declarations must be fully specified.