git.iko.soy/rowtype-yoga/purescript-native
on a10616f help sign in
81 lines 1.7 kB history raw
1-----------------------------------------------------------------------------
2--
3-- Module : PureScript.Values
4-- Copyright : (c) Phil Freeman 2013
5-- License : MIT
6--
7-- Maintainer : Phil Freeman <paf31@cantab.net>
8-- Stability : experimental
9-- Portability :
10--
11-- |
12--
13-----------------------------------------------------------------------------
15module PureScript.Values (
16 UnaryOperator (..),
17 BinaryOperator (..),
18 Value (..),
19 Statement (..),
20 Binder (..)
21) where
23import PureScript.Types
25data UnaryOperator
26 = Negate
27 | Not
28 | BitwiseNot deriving (Show, Eq)
30data BinaryOperator
31 = Add
32 | Subtract
33 | Multiply
34 | Divide
35 | Modulus
36 | EqualTo
37 | NotEqualTo
38 | LessThan
39 | LessThanOrEqualTo
40 | GreaterThan
41 | GreaterThanOrEqualTo
42 | And
43 | Or
44 | BitwiseAnd
45 | BitwiseOr
46 | BitwiseXor
47 | ShiftLeft
48 | ShiftRight
49 | ZeroFillShiftRight
50 | Concat deriving (Show, Eq)
52data Value
53 = NumericLiteral Double
54 | StringLiteral String
55 | BooleanLiteral Bool
56 | Unary UnaryOperator Value
57 | Binary BinaryOperator Value Value
58 | ArrayLiteral [Value]
59 | ObjectLiteral [(String, Value)]
60 | Accessor String Value
61 | Abs [String] Value
62 | App Value [Value]
63 | Var String
64 | Block [Statement]
65 | Constructor String
66 | Case Value [(Binder, Value)]
67 | TypedValue Value Type deriving Show
69data Statement
70 = VariableIntroduction String Value
71 | Assignment String Value
72 | While Value [Statement]
73 | For (Statement, Value, Statement) [Statement]
74 | IfThenElse (Value) [Statement] (Maybe [Statement])
75 | Return Value deriving Show
77data Binder
78 = VarBinder String
79 | NullaryBinder String
80 | UnaryBinder String Binder
81 | ObjectBinder [(String, Binder)] deriving Show