Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data types for modules and declarations
Synopsis
- type Context = [(Ident, SourceType)]
- data TypeSearch
- = TSBefore Environment
- | TSAfter {
- tsAfterIdentifiers :: [(Qualified Text, SourceType)]
- tsAfterRecordFields :: Maybe [(Label, SourceType)]
- onTypeSearchTypes :: (SourceType -> SourceType) -> TypeSearch -> TypeSearch
- onTypeSearchTypesM :: Applicative m => (SourceType -> m SourceType) -> TypeSearch -> m TypeSearch
- data SimpleErrorMessage
- = ModuleNotFound ModuleName
- | ErrorParsingFFIModule FilePath (Maybe ErrorMessage)
- | ErrorParsingModule ParseError
- | ErrorParsingCSTModule ParserError
- | MissingFFIModule ModuleName
- | UnnecessaryFFIModule ModuleName FilePath
- | MissingFFIImplementations ModuleName [Ident]
- | UnusedFFIImplementations ModuleName [Ident]
- | InvalidFFIIdentifier ModuleName Text
- | CannotGetFileInfo FilePath
- | CannotReadFile FilePath
- | CannotWriteFile FilePath
- | InfiniteType SourceType
- | InfiniteKind SourceKind
- | MultipleValueOpFixities (OpName ValueOpName)
- | MultipleTypeOpFixities (OpName TypeOpName)
- | OrphanTypeDeclaration Ident
- | RedefinedIdent Ident
- | OverlappingNamesInLet
- | UnknownName (Qualified Name)
- | UnknownImport ModuleName Name
- | UnknownImportDataConstructor ModuleName (ProperName TypeName) (ProperName ConstructorName)
- | UnknownExport Name
- | UnknownExportDataConstructor (ProperName TypeName) (ProperName ConstructorName)
- | ScopeConflict Name [ModuleName]
- | ScopeShadowing Name (Maybe ModuleName) [ModuleName]
- | DeclConflict Name Name
- | ExportConflict (Qualified Name) (Qualified Name)
- | DuplicateModule ModuleName
- | DuplicateTypeClass (ProperName ClassName) SourceSpan
- | DuplicateInstance Ident SourceSpan
- | DuplicateTypeArgument Text
- | InvalidDoBind
- | InvalidDoLet
- | CycleInDeclaration Ident
- | CycleInTypeSynonym (Maybe (ProperName TypeName))
- | CycleInTypeClassDeclaration [Qualified (ProperName ClassName)]
- | CycleInModules [ModuleName]
- | NameIsUndefined Ident
- | UndefinedTypeVariable (ProperName TypeName)
- | PartiallyAppliedSynonym (Qualified (ProperName TypeName))
- | EscapedSkolem Text (Maybe SourceSpan) SourceType
- | TypesDoNotUnify SourceType SourceType
- | KindsDoNotUnify SourceKind SourceKind
- | ConstrainedTypeUnified SourceType SourceType
- | OverlappingInstances (Qualified (ProperName ClassName)) [SourceType] [Qualified Ident]
- | NoInstanceFound SourceConstraint
- | AmbiguousTypeVariables SourceType SourceConstraint
- | UnknownClass (Qualified (ProperName ClassName))
- | PossiblyInfiniteInstance (Qualified (ProperName ClassName)) [SourceType]
- | CannotDerive (Qualified (ProperName ClassName)) [SourceType]
- | InvalidDerivedInstance (Qualified (ProperName ClassName)) [SourceType] Int
- | ExpectedTypeConstructor (Qualified (ProperName ClassName)) [SourceType] SourceType
- | InvalidNewtypeInstance (Qualified (ProperName ClassName)) [SourceType]
- | MissingNewtypeSuperclassInstance (Qualified (ProperName ClassName)) (Qualified (ProperName ClassName)) [SourceType]
- | UnverifiableSuperclassInstance (Qualified (ProperName ClassName)) (Qualified (ProperName ClassName)) [SourceType]
- | CannotFindDerivingType (ProperName TypeName)
- | DuplicateLabel Label (Maybe Expr)
- | DuplicateValueDeclaration Ident
- | ArgListLengthsDiffer Ident
- | OverlappingArgNames (Maybe Ident)
- | MissingClassMember (NonEmpty (Ident, SourceType))
- | ExtraneousClassMember Ident (Qualified (ProperName ClassName))
- | ExpectedType SourceType SourceKind
- | IncorrectConstructorArity (Qualified (ProperName ConstructorName)) Int Int
- | ExprDoesNotHaveType Expr SourceType
- | PropertyIsMissing Label
- | AdditionalProperty Label
- | TypeSynonymInstance
- | OrphanInstance Ident (Qualified (ProperName ClassName)) (Set ModuleName) [SourceType]
- | InvalidNewtype (ProperName TypeName)
- | InvalidInstanceHead SourceType
- | TransitiveExportError DeclarationRef [DeclarationRef]
- | TransitiveDctorExportError DeclarationRef (ProperName ConstructorName)
- | ShadowedName Ident
- | ShadowedTypeVar Text
- | UnusedTypeVar Text
- | WildcardInferredType SourceType Context
- | HoleInferredType Text SourceType Context (Maybe TypeSearch)
- | MissingTypeDeclaration Ident SourceType
- | OverlappingPattern [[Binder]] Bool
- | IncompleteExhaustivityCheck
- | MisleadingEmptyTypeImport ModuleName (ProperName TypeName)
- | ImportHidingModule ModuleName
- | UnusedImport ModuleName
- | UnusedExplicitImport ModuleName [Name] (Maybe ModuleName) [DeclarationRef]
- | UnusedDctorImport ModuleName (ProperName TypeName) (Maybe ModuleName) [DeclarationRef]
- | UnusedDctorExplicitImport ModuleName (ProperName TypeName) [ProperName ConstructorName] (Maybe ModuleName) [DeclarationRef]
- | DuplicateSelectiveImport ModuleName
- | DuplicateImport ModuleName ImportDeclarationType (Maybe ModuleName)
- | DuplicateImportRef Name
- | DuplicateExportRef Name
- | IntOutOfRange Integer Text Integer Integer
- | ImplicitQualifiedImport ModuleName ModuleName [DeclarationRef]
- | ImplicitQualifiedImportReExport ModuleName ModuleName [DeclarationRef]
- | ImplicitImport ModuleName [DeclarationRef]
- | HidingImport ModuleName [DeclarationRef]
- | CaseBinderLengthDiffers Int [Binder]
- | IncorrectAnonymousArgument
- | InvalidOperatorInBinder (Qualified (OpName ValueOpName)) (Qualified Ident)
- | CannotGeneralizeRecursiveFunction Ident SourceType
- | CannotDeriveNewtypeForData (ProperName TypeName)
- | ExpectedWildcard (ProperName TypeName)
- | CannotUseBindWithDo Ident
- | ClassInstanceArityMismatch Ident (Qualified (ProperName ClassName)) Int Int
- | UserDefinedWarning SourceType
- | UnusableDeclaration Ident [[Text]]
- | CannotDefinePrimModules ModuleName
- | MixedAssociativityError (NonEmpty (Qualified (OpName AnyOpName), Associativity))
- | NonAssociativeError (NonEmpty (Qualified (OpName AnyOpName)))
- data ErrorMessageHint
- = ErrorUnifyingTypes SourceType SourceType
- | ErrorInExpression Expr
- | ErrorInModule ModuleName
- | ErrorInInstance (Qualified (ProperName ClassName)) [SourceType]
- | ErrorInSubsumption SourceType SourceType
- | ErrorCheckingAccessor Expr PSString
- | ErrorCheckingType Expr SourceType
- | ErrorCheckingKind SourceType
- | ErrorCheckingGuard
- | ErrorInferringType Expr
- | ErrorInApplication Expr SourceType Expr
- | ErrorInDataConstructor (ProperName ConstructorName)
- | ErrorInTypeConstructor (ProperName TypeName)
- | ErrorInBindingGroup (NonEmpty Ident)
- | ErrorInDataBindingGroup [ProperName TypeName]
- | ErrorInTypeSynonym (ProperName TypeName)
- | ErrorInValueDeclaration Ident
- | ErrorInTypeDeclaration Ident
- | ErrorInTypeClassDeclaration (ProperName ClassName)
- | ErrorInForeignImport Ident
- | ErrorSolvingConstraint SourceConstraint
- | PositionedError (NonEmpty SourceSpan)
- data HintCategory
- data ErrorMessage = ErrorMessage [ErrorMessageHint] SimpleErrorMessage
- data Module = Module SourceSpan [Comment] ModuleName [Declaration] (Maybe [DeclarationRef])
- getModuleName :: Module -> ModuleName
- getModuleSourceSpan :: Module -> SourceSpan
- getModuleDeclarations :: Module -> [Declaration]
- addDefaultImport :: Qualified ModuleName -> Module -> Module
- importPrim :: Module -> Module
- data DeclarationRef
- = TypeRef SourceSpan (ProperName TypeName) (Maybe [ProperName ConstructorName])
- | TypeOpRef SourceSpan (OpName TypeOpName)
- | ValueRef SourceSpan Ident
- | ValueOpRef SourceSpan (OpName ValueOpName)
- | TypeClassRef SourceSpan (ProperName ClassName)
- | TypeInstanceRef SourceSpan Ident
- | ModuleRef SourceSpan ModuleName
- | KindRef SourceSpan (ProperName KindName)
- | ReExportRef SourceSpan ExportSource DeclarationRef
- data ExportSource = ExportSource {}
- compDecRef :: DeclarationRef -> DeclarationRef -> Ordering
- declRefSourceSpan :: DeclarationRef -> SourceSpan
- declRefName :: DeclarationRef -> Name
- getTypeRef :: DeclarationRef -> Maybe (ProperName TypeName, Maybe [ProperName ConstructorName])
- getTypeOpRef :: DeclarationRef -> Maybe (OpName TypeOpName)
- getValueRef :: DeclarationRef -> Maybe Ident
- getValueOpRef :: DeclarationRef -> Maybe (OpName ValueOpName)
- getTypeClassRef :: DeclarationRef -> Maybe (ProperName ClassName)
- getKindRef :: DeclarationRef -> Maybe (ProperName KindName)
- isModuleRef :: DeclarationRef -> Bool
- data ImportDeclarationType
- isImplicit :: ImportDeclarationType -> Bool
- isExplicit :: ImportDeclarationType -> Bool
- data TypeDeclarationData = TypeDeclarationData {
- tydeclSourceAnn :: !SourceAnn
- tydeclIdent :: !Ident
- tydeclType :: !SourceType
- overTypeDeclaration :: (TypeDeclarationData -> TypeDeclarationData) -> Declaration -> Declaration
- getTypeDeclaration :: Declaration -> Maybe TypeDeclarationData
- unwrapTypeDeclaration :: TypeDeclarationData -> (Ident, SourceType)
- data ValueDeclarationData a = ValueDeclarationData {
- valdeclSourceAnn :: !SourceAnn
- valdeclIdent :: !Ident
- valdeclName :: !NameKind
- valdeclBinders :: ![Binder]
- valdeclExpression :: !a
- overValueDeclaration :: (ValueDeclarationData [GuardedExpr] -> ValueDeclarationData [GuardedExpr]) -> Declaration -> Declaration
- getValueDeclaration :: Declaration -> Maybe (ValueDeclarationData [GuardedExpr])
- pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration
- data Declaration
- = DataDeclaration SourceAnn DataDeclType (ProperName TypeName) [(Text, Maybe SourceKind)] [(ProperName ConstructorName, [(Ident, SourceType)])]
- | DataBindingGroupDeclaration (NonEmpty Declaration)
- | TypeSynonymDeclaration SourceAnn (ProperName TypeName) [(Text, Maybe SourceKind)] SourceType
- | TypeDeclaration !TypeDeclarationData
- | ValueDeclaration !(ValueDeclarationData [GuardedExpr])
- | BoundValueDeclaration SourceAnn Binder Expr
- | BindingGroupDeclaration (NonEmpty ((SourceAnn, Ident), NameKind, Expr))
- | ExternDeclaration SourceAnn Ident SourceType
- | ExternDataDeclaration SourceAnn (ProperName TypeName) SourceKind
- | ExternKindDeclaration SourceAnn (ProperName KindName)
- | FixityDeclaration SourceAnn (Either ValueFixity TypeFixity)
- | ImportDeclaration SourceAnn ModuleName ImportDeclarationType (Maybe ModuleName)
- | TypeClassDeclaration SourceAnn (ProperName ClassName) [(Text, Maybe SourceKind)] [SourceConstraint] [FunctionalDependency] [Declaration]
- | TypeInstanceDeclaration SourceAnn [Ident] Integer Ident [SourceConstraint] (Qualified (ProperName ClassName)) [SourceType] TypeInstanceBody
- data ValueFixity = ValueFixity Fixity (Qualified (Either Ident (ProperName ConstructorName))) (OpName ValueOpName)
- data TypeFixity = TypeFixity Fixity (Qualified (ProperName TypeName)) (OpName TypeOpName)
- pattern ValueFixityDeclaration :: SourceAnn -> Fixity -> Qualified (Either Ident (ProperName ConstructorName)) -> OpName ValueOpName -> Declaration
- pattern TypeFixityDeclaration :: SourceAnn -> Fixity -> Qualified (ProperName TypeName) -> OpName TypeOpName -> Declaration
- data TypeInstanceBody
- mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody
- traverseTypeInstanceBody :: Applicative f => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody
- declSourceAnn :: Declaration -> SourceAnn
- declSourceSpan :: Declaration -> SourceSpan
- declName :: Declaration -> Maybe Name
- isValueDecl :: Declaration -> Bool
- isDataDecl :: Declaration -> Bool
- isImportDecl :: Declaration -> Bool
- isExternDataDecl :: Declaration -> Bool
- isExternKindDecl :: Declaration -> Bool
- isFixityDecl :: Declaration -> Bool
- getFixityDecl :: Declaration -> Maybe (Either ValueFixity TypeFixity)
- isExternDecl :: Declaration -> Bool
- isTypeClassInstanceDeclaration :: Declaration -> Bool
- isTypeClassDeclaration :: Declaration -> Bool
- flattenDecls :: [Declaration] -> [Declaration]
- data Guard
- data GuardedExpr = GuardedExpr [Guard] Expr
- pattern MkUnguarded :: Expr -> GuardedExpr
- data Expr
- = Literal SourceSpan (Literal Expr)
- | UnaryMinus SourceSpan Expr
- | BinaryNoParens Expr Expr Expr
- | Parens Expr
- | Accessor PSString Expr
- | ObjectUpdate Expr [(PSString, Expr)]
- | ObjectUpdateNested Expr (PathTree Expr)
- | Abs Binder Expr
- | App Expr Expr
- | Var SourceSpan (Qualified Ident)
- | Op SourceSpan (Qualified (OpName ValueOpName))
- | IfThenElse Expr Expr Expr
- | Constructor SourceSpan (Qualified (ProperName ConstructorName))
- | Case [Expr] [CaseAlternative]
- | TypedValue Bool Expr SourceType
- | Let WhereProvenance [Declaration] Expr
- | Do (Maybe ModuleName) [DoNotationElement]
- | Ado (Maybe ModuleName) [DoNotationElement] Expr
- | TypeClassDictionaryConstructorApp (Qualified (ProperName ClassName)) Expr
- | TypeClassDictionary SourceConstraint (Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))) [ErrorMessageHint]
- | TypeClassDictionaryAccessor (Qualified (ProperName ClassName)) Ident
- | DeferredDictionary (Qualified (ProperName ClassName)) [SourceType]
- | AnonymousArgument
- | Hole Text
- | PositionedValue SourceSpan [Comment] Expr
- data WhereProvenance
- data CaseAlternative = CaseAlternative {}
- data DoNotationElement
- newtype PathTree t = PathTree (AssocList PSString (PathNode t))
- data PathNode t
- newtype AssocList k t = AssocList {
- runAssocList :: [(k, t)]
- isTrueExpr :: Expr -> Bool
Documentation
type Context = [(Ident, SourceType)] Source #
A map of locally-bound names in scope.
data TypeSearch Source #
Holds the data necessary to do type directed search for typed holes
TSBefore Environment | An Environment captured for later consumption by type directed search |
TSAfter | Results of applying type directed search to the previously captured Environment |
|
Instances
Show TypeSearch Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> TypeSearch -> ShowS # show :: TypeSearch -> String # showList :: [TypeSearch] -> ShowS # |
onTypeSearchTypes :: (SourceType -> SourceType) -> TypeSearch -> TypeSearch Source #
onTypeSearchTypesM :: Applicative m => (SourceType -> m SourceType) -> TypeSearch -> m TypeSearch Source #
data SimpleErrorMessage Source #
A type of error messages
Instances
Show SimpleErrorMessage Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> SimpleErrorMessage -> ShowS # show :: SimpleErrorMessage -> String # showList :: [SimpleErrorMessage] -> ShowS # |
data ErrorMessageHint Source #
Error message hints, providing more detailed information about failure.
Instances
Show ErrorMessageHint Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> ErrorMessageHint -> ShowS # show :: ErrorMessageHint -> String # showList :: [ErrorMessageHint] -> ShowS # |
data HintCategory Source #
Categories of hints
Instances
Eq HintCategory Source # | |
Defined in Language.PureScript.AST.Declarations (==) :: HintCategory -> HintCategory -> Bool # (/=) :: HintCategory -> HintCategory -> Bool # | |
Show HintCategory Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> HintCategory -> ShowS # show :: HintCategory -> String # showList :: [HintCategory] -> ShowS # |
data ErrorMessage Source #
Instances
Show ErrorMessage Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> ErrorMessage -> ShowS # show :: ErrorMessage -> String # showList :: [ErrorMessage] -> ShowS # |
A module declaration, consisting of comments about the module, a module name, a list of declarations, and a list of the declarations that are explicitly exported. If the export list is Nothing, everything is exported.
getModuleName :: Module -> ModuleName Source #
Return a module's name.
getModuleSourceSpan :: Module -> SourceSpan Source #
Return a module's source span.
getModuleDeclarations :: Module -> [Declaration] Source #
Return a module's declarations.
addDefaultImport :: Qualified ModuleName -> Module -> Module Source #
Add an import declaration for a module if it does not already explicitly import it.
Will not import an unqualified module if that module has already been imported qualified. (See #2197)
importPrim :: Module -> Module Source #
Adds import declarations to a module for an implicit Prim import and Prim | qualified as Prim, as necessary.
data DeclarationRef Source #
An item in a list of explicit imports or exports
TypeRef SourceSpan (ProperName TypeName) (Maybe [ProperName ConstructorName]) | A type constructor with data constructors |
TypeOpRef SourceSpan (OpName TypeOpName) | A type operator |
ValueRef SourceSpan Ident | A value |
ValueOpRef SourceSpan (OpName ValueOpName) | A value-level operator |
TypeClassRef SourceSpan (ProperName ClassName) | A type class |
TypeInstanceRef SourceSpan Ident | A type class instance, created during typeclass desugaring (name, class name, instance types) |
ModuleRef SourceSpan ModuleName | A module, in its entirety |
KindRef SourceSpan (ProperName KindName) | A named kind |
ReExportRef SourceSpan ExportSource DeclarationRef | A value re-exported from another module. These will be inserted during elaboration in name desugaring. |
Instances
data ExportSource Source #
Instances
compDecRef :: DeclarationRef -> DeclarationRef -> Ordering Source #
declRefName :: DeclarationRef -> Name Source #
getTypeRef :: DeclarationRef -> Maybe (ProperName TypeName, Maybe [ProperName ConstructorName]) Source #
getTypeOpRef :: DeclarationRef -> Maybe (OpName TypeOpName) Source #
getValueRef :: DeclarationRef -> Maybe Ident Source #
getValueOpRef :: DeclarationRef -> Maybe (OpName ValueOpName) Source #
getKindRef :: DeclarationRef -> Maybe (ProperName KindName) Source #
isModuleRef :: DeclarationRef -> Bool Source #
data ImportDeclarationType Source #
The data type which specifies type of import declaration
Implicit | An import with no explicit list: `import M`. |
Explicit [DeclarationRef] | An import with an explicit list of references to import: `import M (foo)` |
Hiding [DeclarationRef] | An import with a list of references to hide: `import M hiding (foo)` |
Instances
Eq ImportDeclarationType Source # | |
Defined in Language.PureScript.AST.Declarations (==) :: ImportDeclarationType -> ImportDeclarationType -> Bool # (/=) :: ImportDeclarationType -> ImportDeclarationType -> Bool # | |
Show ImportDeclarationType Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> ImportDeclarationType -> ShowS # show :: ImportDeclarationType -> String # showList :: [ImportDeclarationType] -> ShowS # | |
ToJSON ImportDeclarationType Source # | |
Defined in Language.PureScript.AST.Declarations toJSON :: ImportDeclarationType -> Value # toEncoding :: ImportDeclarationType -> Encoding # toJSONList :: [ImportDeclarationType] -> Value # toEncodingList :: [ImportDeclarationType] -> Encoding # | |
FromJSON ImportDeclarationType Source # | |
Defined in Language.PureScript.AST.Declarations parseJSON :: Value -> Parser ImportDeclarationType # parseJSONList :: Value -> Parser [ImportDeclarationType] # |
data TypeDeclarationData Source #
A type declaration assigns a type to an identifier, eg:
identity :: forall a. a -> a
In this example identity
is the identifier and forall a. a -> a
the type.
Instances
Eq TypeDeclarationData Source # | |
Defined in Language.PureScript.AST.Declarations (==) :: TypeDeclarationData -> TypeDeclarationData -> Bool # (/=) :: TypeDeclarationData -> TypeDeclarationData -> Bool # | |
Show TypeDeclarationData Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> TypeDeclarationData -> ShowS # show :: TypeDeclarationData -> String # showList :: [TypeDeclarationData] -> ShowS # |
overTypeDeclaration :: (TypeDeclarationData -> TypeDeclarationData) -> Declaration -> Declaration Source #
data ValueDeclarationData a Source #
A value declaration assigns a name and potential binders, to an expression (or multiple guarded expressions).
double x = x + x
In this example double
is the identifier, x
is a binder and x + x
is the expression.
ValueDeclarationData | |
|
Instances
overValueDeclaration :: (ValueDeclarationData [GuardedExpr] -> ValueDeclarationData [GuardedExpr]) -> Declaration -> Declaration Source #
pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration Source #
data Declaration Source #
The data type of declarations
DataDeclaration SourceAnn DataDeclType (ProperName TypeName) [(Text, Maybe SourceKind)] [(ProperName ConstructorName, [(Ident, SourceType)])] | A data type declaration (data or newtype, name, arguments, data constructors) |
DataBindingGroupDeclaration (NonEmpty Declaration) | A minimal mutually recursive set of data type declarations |
TypeSynonymDeclaration SourceAnn (ProperName TypeName) [(Text, Maybe SourceKind)] SourceType | A type synonym declaration (name, arguments, type) |
TypeDeclaration !TypeDeclarationData | A type declaration for a value (name, ty) |
ValueDeclaration !(ValueDeclarationData [GuardedExpr]) | A value declaration (name, top-level binders, optional guard, value) |
BoundValueDeclaration SourceAnn Binder Expr | A declaration paired with pattern matching in let-in expression (binder, optional guard, value) |
BindingGroupDeclaration (NonEmpty ((SourceAnn, Ident), NameKind, Expr)) | A minimal mutually recursive set of value declarations |
ExternDeclaration SourceAnn Ident SourceType | A foreign import declaration (name, type) |
ExternDataDeclaration SourceAnn (ProperName TypeName) SourceKind | A data type foreign import (name, kind) |
ExternKindDeclaration SourceAnn (ProperName KindName) | A foreign kind import (name) |
FixityDeclaration SourceAnn (Either ValueFixity TypeFixity) | A fixity declaration |
ImportDeclaration SourceAnn ModuleName ImportDeclarationType (Maybe ModuleName) | A module import (module name, qualifiedunqualifiedhiding, optional "qualified as" name) |
TypeClassDeclaration SourceAnn (ProperName ClassName) [(Text, Maybe SourceKind)] [SourceConstraint] [FunctionalDependency] [Declaration] | A type class declaration (name, argument, implies, member declarations) |
TypeInstanceDeclaration SourceAnn [Ident] Integer Ident [SourceConstraint] (Qualified (ProperName ClassName)) [SourceType] TypeInstanceBody | A type instance declaration (instance chain, chain index, name, dependencies, class name, instance types, member declarations) |
Instances
Show Declaration Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> Declaration -> ShowS # show :: Declaration -> String # showList :: [Declaration] -> ShowS # |
data ValueFixity Source #
Instances
Eq ValueFixity Source # | |
Defined in Language.PureScript.AST.Declarations (==) :: ValueFixity -> ValueFixity -> Bool # (/=) :: ValueFixity -> ValueFixity -> Bool # | |
Ord ValueFixity Source # | |
Defined in Language.PureScript.AST.Declarations compare :: ValueFixity -> ValueFixity -> Ordering # (<) :: ValueFixity -> ValueFixity -> Bool # (<=) :: ValueFixity -> ValueFixity -> Bool # (>) :: ValueFixity -> ValueFixity -> Bool # (>=) :: ValueFixity -> ValueFixity -> Bool # max :: ValueFixity -> ValueFixity -> ValueFixity # min :: ValueFixity -> ValueFixity -> ValueFixity # | |
Show ValueFixity Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> ValueFixity -> ShowS # show :: ValueFixity -> String # showList :: [ValueFixity] -> ShowS # |
data TypeFixity Source #
Instances
Eq TypeFixity Source # | |
Defined in Language.PureScript.AST.Declarations (==) :: TypeFixity -> TypeFixity -> Bool # (/=) :: TypeFixity -> TypeFixity -> Bool # | |
Ord TypeFixity Source # | |
Defined in Language.PureScript.AST.Declarations compare :: TypeFixity -> TypeFixity -> Ordering # (<) :: TypeFixity -> TypeFixity -> Bool # (<=) :: TypeFixity -> TypeFixity -> Bool # (>) :: TypeFixity -> TypeFixity -> Bool # (>=) :: TypeFixity -> TypeFixity -> Bool # max :: TypeFixity -> TypeFixity -> TypeFixity # min :: TypeFixity -> TypeFixity -> TypeFixity # | |
Show TypeFixity Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> TypeFixity -> ShowS # show :: TypeFixity -> String # showList :: [TypeFixity] -> ShowS # |
pattern ValueFixityDeclaration :: SourceAnn -> Fixity -> Qualified (Either Ident (ProperName ConstructorName)) -> OpName ValueOpName -> Declaration Source #
pattern TypeFixityDeclaration :: SourceAnn -> Fixity -> Qualified (ProperName TypeName) -> OpName TypeOpName -> Declaration Source #
data TypeInstanceBody Source #
The members of a type class instance declaration
DerivedInstance | This is a derived instance |
NewtypeInstance | This is an instance derived from a newtype |
NewtypeInstanceWithDictionary Expr | This is an instance derived from a newtype, desugared to include a dictionary for the type under the newtype. |
ExplicitInstance [Declaration] | This is a regular (explicit) instance |
Instances
Show TypeInstanceBody Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> TypeInstanceBody -> ShowS # show :: TypeInstanceBody -> String # showList :: [TypeInstanceBody] -> ShowS # |
mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody Source #
traverseTypeInstanceBody :: Applicative f => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody Source #
A traversal for TypeInstanceBody
declSourceAnn :: Declaration -> SourceAnn Source #
isValueDecl :: Declaration -> Bool Source #
Test if a declaration is a value declaration
isDataDecl :: Declaration -> Bool Source #
Test if a declaration is a data type or type synonym declaration
isImportDecl :: Declaration -> Bool Source #
Test if a declaration is a module import
isExternDataDecl :: Declaration -> Bool Source #
Test if a declaration is a data type foreign import
isExternKindDecl :: Declaration -> Bool Source #
Test if a declaration is a foreign kind import
isFixityDecl :: Declaration -> Bool Source #
Test if a declaration is a fixity declaration
isExternDecl :: Declaration -> Bool Source #
Test if a declaration is a foreign import
isTypeClassInstanceDeclaration :: Declaration -> Bool Source #
Test if a declaration is a type class instance declaration
isTypeClassDeclaration :: Declaration -> Bool Source #
Test if a declaration is a type class declaration
flattenDecls :: [Declaration] -> [Declaration] Source #
Recursively flatten data binding groups in the list of declarations
A guard is just a boolean-valued expression that appears alongside a set of binders
data GuardedExpr Source #
The right hand side of a binder in value declarations and case expressions.
Instances
Show GuardedExpr Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> GuardedExpr -> ShowS # show :: GuardedExpr -> String # showList :: [GuardedExpr] -> ShowS # |
pattern MkUnguarded :: Expr -> GuardedExpr Source #
Data type for expressions and terms
Literal SourceSpan (Literal Expr) | A literal value |
UnaryMinus SourceSpan Expr | A prefix -, will be desugared |
BinaryNoParens Expr Expr Expr | Binary operator application. During the rebracketing phase of desugaring, this data constructor will be removed. |
Parens Expr | Explicit parentheses. During the rebracketing phase of desugaring, this data constructor will be removed. Note: although it seems this constructor is not used, it _is_ useful, since it prevents certain traversals from matching. |
Accessor PSString Expr | An record property accessor expression (e.g. `obj.x` or `_.x`). Anonymous arguments will be removed during desugaring and expanded into a lambda that reads a property from a record. |
ObjectUpdate Expr [(PSString, Expr)] | Partial record update |
ObjectUpdateNested Expr (PathTree Expr) | Object updates with nested support: `x { foo { bar = e } }`
Replaced during desugaring into a |
Abs Binder Expr | Function introduction |
App Expr Expr | Function application |
Var SourceSpan (Qualified Ident) | Variable |
Op SourceSpan (Qualified (OpName ValueOpName)) | An operator. This will be desugared into a function during the "operators" phase of desugaring. |
IfThenElse Expr Expr Expr | Conditional (if-then-else expression) |
Constructor SourceSpan (Qualified (ProperName ConstructorName)) | A data constructor |
Case [Expr] [CaseAlternative] | A case expression. During the case expansion phase of desugaring, top-level binders will get desugared into case expressions, hence the need for guards and multiple binders per branch here. |
TypedValue Bool Expr SourceType | A value with a type annotation |
Let WhereProvenance [Declaration] Expr | A let binding |
Do (Maybe ModuleName) [DoNotationElement] | A do-notation block |
Ado (Maybe ModuleName) [DoNotationElement] Expr | An ado-notation block |
TypeClassDictionaryConstructorApp (Qualified (ProperName ClassName)) Expr | An application of a typeclass dictionary constructor. The value should be an ObjectLiteral. |
TypeClassDictionary SourceConstraint (Map (Maybe ModuleName) (Map (Qualified (ProperName ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))) [ErrorMessageHint] | A placeholder for a type class dictionary to be inserted later. At the end of type checking, these placeholders will be replaced with actual expressions representing type classes dictionaries which can be evaluated at runtime. The constructor arguments represent (in order): whether or not to look at superclass implementations when searching for a dictionary, the type class name and instance type, and the type class dictionaries in scope. |
TypeClassDictionaryAccessor (Qualified (ProperName ClassName)) Ident | A typeclass dictionary accessor, the implementation is left unspecified until CoreFn desugaring. |
DeferredDictionary (Qualified (ProperName ClassName)) [SourceType] | A placeholder for a superclass dictionary to be turned into a TypeClassDictionary during typechecking |
AnonymousArgument | A placeholder for an anonymous function argument |
Hole Text | A typed hole that will be turned into a hint/error during typechecking |
PositionedValue SourceSpan [Comment] Expr | A value with source position information |
data WhereProvenance Source #
Metadata that tells where a let binding originated
FromWhere | The let binding was originally a where clause |
FromLet | The let binding was always a let binding |
Instances
Show WhereProvenance Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> WhereProvenance -> ShowS # show :: WhereProvenance -> String # showList :: [WhereProvenance] -> ShowS # |
data CaseAlternative Source #
An alternative in a case statement
CaseAlternative | |
|
Instances
Show CaseAlternative Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> CaseAlternative -> ShowS # show :: CaseAlternative -> String # showList :: [CaseAlternative] -> ShowS # |
data DoNotationElement Source #
A statement in a do-notation block
DoNotationValue Expr | A monadic value without a binder |
DoNotationBind Binder Expr | A monadic value with a binder |
DoNotationLet [Declaration] | A let statement, i.e. a pure value with a binder |
PositionedDoNotationElement SourceSpan [Comment] DoNotationElement | A do notation element with source position information |
Instances
Show DoNotationElement Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> DoNotationElement -> ShowS # show :: DoNotationElement -> String # showList :: [DoNotationElement] -> ShowS # |
Instances
Functor PathTree Source # | |
Foldable PathTree Source # | |
Defined in Language.PureScript.AST.Declarations fold :: Monoid m => PathTree m -> m # foldMap :: Monoid m => (a -> m) -> PathTree a -> m # foldr :: (a -> b -> b) -> b -> PathTree a -> b # foldr' :: (a -> b -> b) -> b -> PathTree a -> b # foldl :: (b -> a -> b) -> b -> PathTree a -> b # foldl' :: (b -> a -> b) -> b -> PathTree a -> b # foldr1 :: (a -> a -> a) -> PathTree a -> a # foldl1 :: (a -> a -> a) -> PathTree a -> a # elem :: Eq a => a -> PathTree a -> Bool # maximum :: Ord a => PathTree a -> a # minimum :: Ord a => PathTree a -> a # | |
Traversable PathTree Source # | |
Defined in Language.PureScript.AST.Declarations | |
Eq t => Eq (PathTree t) Source # | |
Ord t => Ord (PathTree t) Source # | |
Defined in Language.PureScript.AST.Declarations | |
Show t => Show (PathTree t) Source # | |
Instances
Functor PathNode Source # | |
Foldable PathNode Source # | |
Defined in Language.PureScript.AST.Declarations fold :: Monoid m => PathNode m -> m # foldMap :: Monoid m => (a -> m) -> PathNode a -> m # foldr :: (a -> b -> b) -> b -> PathNode a -> b # foldr' :: (a -> b -> b) -> b -> PathNode a -> b # foldl :: (b -> a -> b) -> b -> PathNode a -> b # foldl' :: (b -> a -> b) -> b -> PathNode a -> b # foldr1 :: (a -> a -> a) -> PathNode a -> a # foldl1 :: (a -> a -> a) -> PathNode a -> a # elem :: Eq a => a -> PathNode a -> Bool # maximum :: Ord a => PathNode a -> a # minimum :: Ord a => PathNode a -> a # | |
Traversable PathNode Source # | |
Defined in Language.PureScript.AST.Declarations | |
Eq t => Eq (PathNode t) Source # | |
Ord t => Ord (PathNode t) Source # | |
Defined in Language.PureScript.AST.Declarations | |
Show t => Show (PathNode t) Source # | |
newtype AssocList k t Source #
AssocList | |
|
Instances
isTrueExpr :: Expr -> Bool Source #