Language.PureScript.CoreFn.Expr

purescript-0.15.15: PureScript Programming Language Compiler

Safe Haskell | None
Language | Haskell2010

Language.PureScript.CoreFn.Expr

Description

The core functional representation

Synopsis

- data Expr a
  - = Literal a (Literal (Expr a))
  - | Constructor a (ProperName 'TypeName) (ProperName 'ConstructorName) [Ident]
  - | Accessor a PSString (Expr a)
  - | ObjectUpdate a (Expr a) (Maybe [PSString]) [(PSString, Expr a)]
  - | Abs a Ident (Expr a)
  - | App a (Expr a) (Expr a)
  - | Var a (Qualified Ident)
  - | Case a [Expr a] [CaseAlternative a]
  - | Let a [Bind a] (Expr a)
- data Bind a
  - = NonRec a Ident (Expr a)
  - | Rec [((a, Ident), Expr a)]
- type Guard a = Expr a
- data CaseAlternative a = CaseAlternative {
  - caseAlternativeBinders :: [Binder a]
  - caseAlternativeResult :: Either [(Guard a, Expr a)] (Expr a)
  }
- extractAnn :: Expr a -> a
- modifyAnn :: (a -> a) -> Expr a -> Expr a

# Documentation

data Expr a #

Data type for expressions and terms

Constructors

Literal a (Literal (Expr a)) | A literal value
Constructor a (ProperName 'TypeName) (ProperName 'ConstructorName) [Ident] | A data constructor (type name, constructor name, field names)
Accessor a PSString (Expr a) | A record property accessor
ObjectUpdate a (Expr a) (Maybe [PSString]) [(PSString, Expr a)] | Partial record update (original value, fields to copy (if known), fields to update)
Abs a Ident (Expr a) | Function introduction
App a (Expr a) (Expr a) | Function application
Var a (Qualified Ident) | Variable
Case a [Expr a] [CaseAlternative a] | A case expression
Let a [Bind a] (Expr a) | A let binding

#### Instances

Instances details

Functor Expr # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods fmap :: (a -> b) -> Expr a -> Expr b # (<$) :: a -> Expr b -> Expr a #
Show a => Show (Expr a) # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods showsPrec :: Int -> Expr a -> ShowS # show :: Expr a -> String # showList :: [Expr a] -> ShowS #
Eq a => Eq (Expr a) # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods (==) :: Expr a -> Expr a -> Bool # (/=) :: Expr a -> Expr a -> Bool #
Ord a => Ord (Expr a) # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods compare :: Expr a -> Expr a -> Ordering # (<) :: Expr a -> Expr a -> Bool # (<=) :: Expr a -> Expr a -> Bool # (>) :: Expr a -> Expr a -> Bool # (>=) :: Expr a -> Expr a -> Bool # max :: Expr a -> Expr a -> Expr a # min :: Expr a -> Expr a -> Expr a #

data Bind a #

A let or module binding.

Constructors

NonRec a Ident (Expr a) | Non-recursive binding for a single value
Rec [((a, Ident), Expr a)] | Mutually recursive binding group for several values

#### Instances

Instances details

Functor Bind # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods fmap :: (a -> b) -> Bind a -> Bind b # (<$) :: a -> Bind b -> Bind a #
Show a => Show (Bind a) # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods showsPrec :: Int -> Bind a -> ShowS # show :: Bind a -> String # showList :: [Bind a] -> ShowS #
Eq a => Eq (Bind a) # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods (==) :: Bind a -> Bind a -> Bool # (/=) :: Bind a -> Bind a -> Bool #
Ord a => Ord (Bind a) # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods compare :: Bind a -> Bind a -> Ordering # (<) :: Bind a -> Bind a -> Bool # (<=) :: Bind a -> Bind a -> Bool # (>) :: Bind a -> Bind a -> Bool # (>=) :: Bind a -> Bind a -> Bool # max :: Bind a -> Bind a -> Bind a # min :: Bind a -> Bind a -> Bind a #

type Guard a = Expr a #

A guard is just a boolean-valued expression that appears alongside a set of binders

data CaseAlternative a #

An alternative in a case statement

Constructors

CaseAlternative |
Fields caseAlternativeBinders :: [Binder a] A collection of binders with which to match the inputs caseAlternativeResult :: Either [(Guard a, Expr a)] (Expr a) The result expression or a collect of guarded expressions

#### Instances

Instances details

Functor CaseAlternative # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods fmap :: (a -> b) -> CaseAlternative a -> CaseAlternative b # (<$) :: a -> CaseAlternative b -> CaseAlternative a #
Show a => Show (CaseAlternative a) # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods showsPrec :: Int -> CaseAlternative a -> ShowS # show :: CaseAlternative a -> String # showList :: [CaseAlternative a] -> ShowS #
Eq a => Eq (CaseAlternative a) # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods (==) :: CaseAlternative a -> CaseAlternative a -> Bool # (/=) :: CaseAlternative a -> CaseAlternative a -> Bool #
Ord a => Ord (CaseAlternative a) # |
Instance details Defined in Language.PureScript.CoreFn.Expr Methods compare :: CaseAlternative a -> CaseAlternative a -> Ordering # (<) :: CaseAlternative a -> CaseAlternative a -> Bool # (<=) :: CaseAlternative a -> CaseAlternative a -> Bool # (>) :: CaseAlternative a -> CaseAlternative a -> Bool # (>=) :: CaseAlternative a -> CaseAlternative a -> Bool # max :: CaseAlternative a -> CaseAlternative a -> CaseAlternative a # min :: CaseAlternative a -> CaseAlternative a -> CaseAlternative a #

extractAnn :: Expr a -> a #

Extract the annotation from a term

modifyAnn :: (a -> a) -> Expr a -> Expr a #

Modify the annotation on a term