purescript-0.15.15: PureScript Programming Language Compiler

Safe Haskell | None
Language | Haskell2010

Language.PureScript.AST.Binders

Description

Case binders

Synopsis

- data Binder
  - = NullBinder
  - | LiteralBinder SourceSpan (Literal Binder)
  - | VarBinder SourceSpan Ident
  - | ConstructorBinder SourceSpan (Qualified (ProperName 'ConstructorName)) [Binder]
  - | OpBinder SourceSpan (Qualified (OpName 'ValueOpName))
  - | BinaryNoParensBinder Binder Binder Binder
  - | ParensInBinder Binder
  - | NamedBinder SourceSpan Ident Binder
  - | PositionedBinder SourceSpan [Comment] Binder
  - | TypedBinder SourceType Binder
- binderNames :: Binder -> [Ident]
- binderNamesWithSpans :: Binder -> [(SourceSpan, Ident)]
- isIrrefutable :: Binder -> Bool

# Documentation

data Binder #

Data type for binders

Constructors

NullBinder | Wildcard binder
LiteralBinder SourceSpan (Literal Binder) | A binder which matches a literal
VarBinder SourceSpan Ident | A binder which binds an identifier
ConstructorBinder SourceSpan (Qualified (ProperName 'ConstructorName)) [Binder] | A binder which matches a data constructor
OpBinder SourceSpan (Qualified (OpName 'ValueOpName)) | A operator alias binder. During the rebracketing phase of desugaring, this data constructor will be removed.
BinaryNoParensBinder Binder Binder Binder | Binary operator application. During the rebracketing phase of desugaring, this data constructor will be removed.
ParensInBinder Binder | 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.
NamedBinder SourceSpan Ident Binder | A binder which binds its input to an identifier
PositionedBinder SourceSpan [Comment] Binder | A binder with source position information
TypedBinder SourceType Binder | A binder with a type annotation

#### Instances

Instances details

Generic Binder # |

Instance details

Defined in Language.PureScript.AST.Binders

Associated Types

type Rep Binder |

Instance details

Defined in Language.PureScript.AST.Binders

type Rep Binder = D1 ('MetaData "Binder" "Language.PureScript.AST.Binders" "purescript-0.15.15-2PRN9Yi4DizG6PDa5K8ocU" 'False) (((C1 ('MetaCons "NullBinder" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LiteralBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Literal Binder)))) :+: (C1 ('MetaCons "VarBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :+: (C1 ('MetaCons "ConstructorBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Qualified (ProperName 'ConstructorName))) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Binder]))) :+: C1 ('MetaCons "OpBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Qualified (OpName 'ValueOpName))))))) :+: ((C1 ('MetaCons "BinaryNoParensBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder))) :+: C1 ('MetaCons "ParensInBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder))) :+: (C1 ('MetaCons "NamedBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder))) :+: (C1 ('MetaCons "PositionedBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Comment]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder))) :+: C1 ('MetaCons "TypedBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceType) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder))))))

Methods

from :: Binder -> Rep Binder x #

to :: Rep Binder x -> Binder #

Show Binder # |
Instance details Defined in Language.PureScript.AST.Binders Methods showsPrec :: Int -> Binder -> ShowS # show :: Binder -> String # showList :: [Binder] -> ShowS #
NFData Binder # |
Instance details Defined in Language.PureScript.AST.Binders Methods rnf :: Binder -> () #
Eq Binder # |
Instance details Defined in Language.PureScript.AST.Binders Methods (==) :: Binder -> Binder -> Bool # (/=) :: Binder -> Binder -> Bool #
Ord Binder # |
Instance details Defined in Language.PureScript.AST.Binders Methods compare :: Binder -> Binder -> Ordering # (<) :: Binder -> Binder -> Bool # (<=) :: Binder -> Binder -> Bool # (>) :: Binder -> Binder -> Bool # (>=) :: Binder -> Binder -> Bool # max :: Binder -> Binder -> Binder # min :: Binder -> Binder -> Binder #
type Rep Binder # |

Instance details

Defined in Language.PureScript.AST.Binders

type Rep Binder = D1 ('MetaData "Binder" "Language.PureScript.AST.Binders" "purescript-0.15.15-2PRN9Yi4DizG6PDa5K8ocU" 'False) (((C1 ('MetaCons "NullBinder" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LiteralBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Literal Binder)))) :+: (C1 ('MetaCons "VarBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)) :+: (C1 ('MetaCons "ConstructorBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Qualified (ProperName 'ConstructorName))) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Binder]))) :+: C1 ('MetaCons "OpBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Qualified (OpName 'ValueOpName))))))) :+: ((C1 ('MetaCons "BinaryNoParensBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder))) :+: C1 ('MetaCons "ParensInBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder))) :+: (C1 ('MetaCons "NamedBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder))) :+: (C1 ('MetaCons "PositionedBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceSpan) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Comment]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder))) :+: C1 ('MetaCons "TypedBinder" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceType) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Binder))))))

binderNames :: Binder -> [Ident] #

Collect all names introduced in binders in an expression

binderNamesWithSpans :: Binder -> [(SourceSpan, Ident)] #

isIrrefutable :: Binder -> Bool #