Safe Haskell | Safe-Inferred |
---|---|
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 ErrorMessageHint
- = ErrorUnifyingTypes SourceType SourceType
- | ErrorInExpression Expr
- | ErrorInModule ModuleName
- | ErrorInInstance (Qualified (ProperName 'ClassName)) [SourceType]
- | ErrorInSubsumption SourceType SourceType
- | ErrorInRowLabel Label
- | ErrorCheckingAccessor Expr PSString
- | ErrorCheckingType Expr SourceType
- | ErrorCheckingKind SourceType SourceType
- | ErrorCheckingGuard
- | ErrorInferringType Expr
- | ErrorInferringKind SourceType
- | 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)
- | ErrorInKindDeclaration (ProperName 'TypeName)
- | ErrorInRoleDeclaration (ProperName 'TypeName)
- | ErrorInForeignImport Ident
- | ErrorInForeignImportData (ProperName 'TypeName)
- | ErrorSolvingConstraint SourceConstraint
- | MissingConstructorImportForCoercible (Qualified (ProperName 'ConstructorName))
- | PositionedError (NonEmpty SourceSpan)
- | RelatedPositions (NonEmpty SourceSpan)
- data HintCategory
- data UnknownsHint
- = NoUnknowns
- | Unknowns
- | UnknownsWithVtaRequiringArgs (NonEmpty (Qualified Ident, [[Text]]))
- 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 NameSource
- data DeclarationRef
- = TypeClassRef SourceSpan (ProperName 'ClassName)
- | TypeOpRef SourceSpan (OpName 'TypeOpName)
- | TypeRef SourceSpan (ProperName 'TypeName) (Maybe [ProperName 'ConstructorName])
- | ValueRef SourceSpan Ident
- | ValueOpRef SourceSpan (OpName 'ValueOpName)
- | TypeInstanceRef SourceSpan Ident NameSource
- | ModuleRef SourceSpan ModuleName
- | ReExportRef SourceSpan ExportSource DeclarationRef
- data ExportSource = ExportSource {}
- 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)
- isModuleRef :: DeclarationRef -> Bool
- data ImportDeclarationType
- isExplicit :: ImportDeclarationType -> Bool
- data RoleDeclarationData = RoleDeclarationData {
- rdeclSourceAnn :: !SourceAnn
- rdeclIdent :: !(ProperName 'TypeName)
- rdeclRoles :: ![Role]
- data TypeDeclarationData = TypeDeclarationData {
- tydeclSourceAnn :: !SourceAnn
- tydeclIdent :: !Ident
- tydeclType :: !SourceType
- getTypeDeclaration :: Declaration -> Maybe TypeDeclarationData
- unwrapTypeDeclaration :: TypeDeclarationData -> (Ident, SourceType)
- data ValueDeclarationData a = ValueDeclarationData {
- valdeclSourceAnn :: !SourceAnn
- valdeclIdent :: !Ident
- valdeclName :: !NameKind
- valdeclBinders :: ![Binder]
- valdeclExpression :: !a
- getValueDeclaration :: Declaration -> Maybe (ValueDeclarationData [GuardedExpr])
- pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration
- data DataConstructorDeclaration = DataConstructorDeclaration {
- dataCtorAnn :: !SourceAnn
- dataCtorName :: !(ProperName 'ConstructorName)
- dataCtorFields :: ![(Ident, SourceType)]
- mapDataCtorFields :: ([(Ident, SourceType)] -> [(Ident, SourceType)]) -> DataConstructorDeclaration -> DataConstructorDeclaration
- traverseDataCtorFields :: Monad m => ([(Ident, SourceType)] -> m [(Ident, SourceType)]) -> DataConstructorDeclaration -> m DataConstructorDeclaration
- data Declaration
- = DataDeclaration SourceAnn DataDeclType (ProperName 'TypeName) [(Text, Maybe SourceType)] [DataConstructorDeclaration]
- | DataBindingGroupDeclaration (NonEmpty Declaration)
- | TypeSynonymDeclaration SourceAnn (ProperName 'TypeName) [(Text, Maybe SourceType)] SourceType
- | KindDeclaration SourceAnn KindSignatureFor (ProperName 'TypeName) SourceType
- | RoleDeclaration !RoleDeclarationData
- | TypeDeclaration !TypeDeclarationData
- | ValueDeclaration !(ValueDeclarationData [GuardedExpr])
- | BoundValueDeclaration SourceAnn Binder Expr
- | BindingGroupDeclaration (NonEmpty ((SourceAnn, Ident), NameKind, Expr))
- | ExternDeclaration SourceAnn Ident SourceType
- | ExternDataDeclaration SourceAnn (ProperName 'TypeName) SourceType
- | FixityDeclaration SourceAnn (Either ValueFixity TypeFixity)
- | ImportDeclaration SourceAnn ModuleName ImportDeclarationType (Maybe ModuleName)
- | TypeClassDeclaration SourceAnn (ProperName 'ClassName) [(Text, Maybe SourceType)] [SourceConstraint] [FunctionalDependency] [Declaration]
- | TypeInstanceDeclaration SourceAnn SourceAnn ChainId Integer (Either Text 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 InstanceDerivationStrategy
- data TypeInstanceBody
- mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody
- traverseTypeInstanceBody :: Applicative f => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody
- data KindSignatureFor
- declSourceAnn :: Declaration -> SourceAnn
- declSourceSpan :: Declaration -> SourceSpan
- declName :: Declaration -> Maybe Name
- isValueDecl :: Declaration -> Bool
- isDataDecl :: Declaration -> Bool
- isTypeSynonymDecl :: Declaration -> Bool
- isImportDecl :: Declaration -> Bool
- isRoleDecl :: Declaration -> Bool
- isExternDataDecl :: Declaration -> Bool
- isFixityDecl :: Declaration -> Bool
- getFixityDecl :: Declaration -> Maybe (Either ValueFixity TypeFixity)
- isExternDecl :: Declaration -> Bool
- isTypeClassInstanceDecl :: Declaration -> Bool
- isTypeClassDecl :: Declaration -> Bool
- isKindDecl :: 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
- | VisibleTypeApp Expr SourceType
- | Unused 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
- | TypeClassDictionary SourceConstraint (Map QualifiedBy (Map (Qualified (ProperName 'ClassName)) (Map (Qualified Ident) (NonEmpty NamedDict)))) [ErrorMessageHint]
- | DeferredDictionary (Qualified (ProperName 'ClassName)) [SourceType]
- | DerivedInstancePlaceholder (Qualified (ProperName 'ClassName)) InstanceDerivationStrategy
- | 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
- isAnonymousArgument :: 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
onTypeSearchTypes :: (SourceType -> SourceType) -> TypeSearch -> TypeSearch Source #
onTypeSearchTypesM :: Applicative m => (SourceType -> m SourceType) -> TypeSearch -> m TypeSearch Source #
data ErrorMessageHint Source #
Error message hints, providing more detailed information about failure.
Instances
data HintCategory Source #
Categories of hints
Instances
Show HintCategory Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> HintCategory -> ShowS # show :: HintCategory -> String # showList :: [HintCategory] -> ShowS # | |
Eq HintCategory Source # | |
Defined in Language.PureScript.AST.Declarations (==) :: HintCategory -> HintCategory -> Bool # (/=) :: HintCategory -> HintCategory -> Bool # |
data UnknownsHint Source #
In constraint solving, indicates whether there were TypeUnknown
s that prevented
an instance from being found, and whether VTAs are required
due to type class members not referencing all the type class
head's type variables.
Instances
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 NameSource Source #
Instances
data DeclarationRef Source #
An item in a list of explicit imports or exports
TypeClassRef SourceSpan (ProperName 'ClassName) | A type class |
TypeOpRef SourceSpan (OpName 'TypeOpName) | A type operator |
TypeRef SourceSpan (ProperName 'TypeName) (Maybe [ProperName 'ConstructorName]) | A type constructor with data constructors |
ValueRef SourceSpan Ident | A value |
ValueOpRef SourceSpan (OpName 'ValueOpName) | A value-level operator |
TypeInstanceRef SourceSpan Ident NameSource | A type class instance, created during typeclass desugaring |
ModuleRef SourceSpan ModuleName | A module, in its entirety |
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
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 #
getTypeClassRef :: DeclarationRef -> Maybe (ProperName 'ClassName) 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
data RoleDeclarationData Source #
A role declaration assigns a list of roles to a type constructor's parameters, e.g.:
type role T representational phantom
In this example, T
is the identifier and [representational, phantom]
is
the list of roles (T
presumably having two parameters).
RoleDeclarationData | |
|
Instances
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
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
pattern ValueDecl :: SourceAnn -> Ident -> NameKind -> [Binder] -> [GuardedExpr] -> Declaration Source #
data DataConstructorDeclaration Source #
DataConstructorDeclaration | |
|
Instances
mapDataCtorFields :: ([(Ident, SourceType)] -> [(Ident, SourceType)]) -> DataConstructorDeclaration -> DataConstructorDeclaration Source #
traverseDataCtorFields :: Monad m => ([(Ident, SourceType)] -> m [(Ident, SourceType)]) -> DataConstructorDeclaration -> m DataConstructorDeclaration Source #
data Declaration Source #
The data type of declarations
DataDeclaration SourceAnn DataDeclType (ProperName 'TypeName) [(Text, Maybe SourceType)] [DataConstructorDeclaration] | 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 SourceType)] SourceType | A type synonym declaration (name, arguments, type) |
KindDeclaration SourceAnn KindSignatureFor (ProperName 'TypeName) SourceType | A kind signature declaration |
RoleDeclaration !RoleDeclarationData | A role declaration (name, roles) |
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) SourceType | A data type foreign import (name, kind) |
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 SourceType)] [SourceConstraint] [FunctionalDependency] [Declaration] | A type class declaration (name, argument, implies, member declarations) |
TypeInstanceDeclaration SourceAnn SourceAnn ChainId Integer (Either Text Ident) [SourceConstraint] (Qualified (ProperName 'ClassName)) [SourceType] TypeInstanceBody | A type instance declaration (instance chain, chain index, name, dependencies, class name, instance types, member declarations) The first |
Instances
data ValueFixity Source #
Instances
data TypeFixity Source #
Instances
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 InstanceDerivationStrategy Source #
Instances
Generic InstanceDerivationStrategy Source # | |
Defined in Language.PureScript.AST.Declarations type Rep InstanceDerivationStrategy :: Type -> Type # | |
Show InstanceDerivationStrategy Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> InstanceDerivationStrategy -> ShowS # show :: InstanceDerivationStrategy -> String # showList :: [InstanceDerivationStrategy] -> ShowS # | |
NFData InstanceDerivationStrategy Source # | |
Defined in Language.PureScript.AST.Declarations rnf :: InstanceDerivationStrategy -> () # | |
type Rep InstanceDerivationStrategy Source # | |
Defined in Language.PureScript.AST.Declarations type Rep InstanceDerivationStrategy = D1 ('MetaData "InstanceDerivationStrategy" "Language.PureScript.AST.Declarations" "purescript-0.15.14-JcflwnDm1Hv5HxS5CV5TJ2" 'False) (C1 ('MetaCons "KnownClassStrategy" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NewtypeStrategy" 'PrefixI 'False) (U1 :: Type -> Type)) |
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 |
ExplicitInstance [Declaration] | This is a regular (explicit) instance |
Instances
mapTypeInstanceBody :: ([Declaration] -> [Declaration]) -> TypeInstanceBody -> TypeInstanceBody Source #
traverseTypeInstanceBody :: Applicative f => ([Declaration] -> f [Declaration]) -> TypeInstanceBody -> f TypeInstanceBody Source #
A traversal for TypeInstanceBody
data KindSignatureFor Source #
What sort of declaration the kind signature applies to.
Instances
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 declaration
isTypeSynonymDecl :: Declaration -> Bool Source #
Test if a declaration is a type synonym declaration
isImportDecl :: Declaration -> Bool Source #
Test if a declaration is a module import
isRoleDecl :: Declaration -> Bool Source #
Test if a declaration is a role declaration
isExternDataDecl :: Declaration -> Bool Source #
Test if a declaration is a data type foreign 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
isTypeClassInstanceDecl :: Declaration -> Bool Source #
Test if a declaration is a type class instance declaration
isTypeClassDecl :: Declaration -> Bool Source #
Test if a declaration is a type class declaration
isKindDecl :: Declaration -> Bool Source #
Test if a declaration is a kind signature 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
Instances
Generic Guard Source # | |
Show Guard Source # | |
NFData Guard Source # | |
Defined in Language.PureScript.AST.Declarations | |
type Rep Guard Source # | |
Defined in Language.PureScript.AST.Declarations type Rep Guard = D1 ('MetaData "Guard" "Language.PureScript.AST.Declarations" "purescript-0.15.14-JcflwnDm1Hv5HxS5CV5TJ2" 'False) (C1 ('MetaCons "ConditionGuard" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Expr)) :+: C1 ('MetaCons "PatternGuard" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Expr))) |
data GuardedExpr Source #
The right hand side of a binder in value declarations and case expressions.
Instances
Generic GuardedExpr Source # | |
Defined in Language.PureScript.AST.Declarations type Rep GuardedExpr :: Type -> Type # from :: GuardedExpr -> Rep GuardedExpr x # to :: Rep GuardedExpr x -> GuardedExpr # | |
Show GuardedExpr Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> GuardedExpr -> ShowS # show :: GuardedExpr -> String # showList :: [GuardedExpr] -> ShowS # | |
NFData GuardedExpr Source # | |
Defined in Language.PureScript.AST.Declarations rnf :: GuardedExpr -> () # | |
type Rep GuardedExpr Source # | |
Defined in Language.PureScript.AST.Declarations type Rep GuardedExpr = D1 ('MetaData "GuardedExpr" "Language.PureScript.AST.Declarations" "purescript-0.15.14-JcflwnDm1Hv5HxS5CV5TJ2" 'False) (C1 ('MetaCons "GuardedExpr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Guard]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Expr))) |
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 |
VisibleTypeApp Expr SourceType | A type application (e.g. `f @Int`) |
Unused Expr | Hint that an expression is unused.
This is used to ignore type class dictionaries that are necessarily empty.
The inner expression lets us solve subgoals before eliminating the whole expression.
The code gen will render this as |
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 |
TypeClassDictionary SourceConstraint (Map QualifiedBy (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. |
DeferredDictionary (Qualified (ProperName 'ClassName)) [SourceType] | A placeholder for a superclass dictionary to be turned into a TypeClassDictionary during typechecking |
DerivedInstancePlaceholder (Qualified (ProperName 'ClassName)) InstanceDerivationStrategy | A placeholder for a type class instance to be derived 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 |
Instances
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
Generic WhereProvenance Source # | |
Defined in Language.PureScript.AST.Declarations type Rep WhereProvenance :: Type -> Type # from :: WhereProvenance -> Rep WhereProvenance x # to :: Rep WhereProvenance x -> WhereProvenance # | |
Show WhereProvenance Source # | |
Defined in Language.PureScript.AST.Declarations showsPrec :: Int -> WhereProvenance -> ShowS # show :: WhereProvenance -> String # showList :: [WhereProvenance] -> ShowS # | |
NFData WhereProvenance Source # | |
Defined in Language.PureScript.AST.Declarations rnf :: WhereProvenance -> () # | |
type Rep WhereProvenance Source # | |
Defined in Language.PureScript.AST.Declarations |
data CaseAlternative Source #
An alternative in a case statement
CaseAlternative | |
|
Instances
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
Instances
Foldable PathTree Source # | |
Defined in Language.PureScript.AST.Declarations fold :: Monoid m => PathTree m -> m # foldMap :: Monoid m => (a -> m) -> PathTree a -> 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 | |
Functor PathTree Source # | |
Show t => Show (PathTree t) Source # | |
NFData t => NFData (PathTree t) 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 |
Instances
newtype AssocList k t Source #
AssocList | |
|
Instances
isTrueExpr :: Expr -> Bool Source #
isAnonymousArgument :: Expr -> Bool Source #