git.iko.soy/rowtype-yoga/purescript-native
on ae6037f help sign in
86 lines 1.9 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 (Either Integer Double)
54 | StringLiteral String
55 | BooleanLiteral Bool
56 | Unary UnaryOperator Value
57 | Binary BinaryOperator Value Value
58 | ArrayLiteral [Value]
59 | Indexer Value Value
60 | ObjectLiteral [(String, Value)]
61 | Accessor String Value
62 | Abs [String] Value
63 | App Value [Value]
64 | Var String
65 | Block [Statement]
66 | Constructor String
67 | Case Value [(Binder, Value)]
68 | TypedValue Value Type deriving Show
70data Statement
71 = VariableIntroduction String Value
72 | Assignment String Value
73 | While Value [Statement]
74 | For (Statement, Value, Statement) [Statement]
75 | IfThenElse (Value) [Statement] (Maybe [Statement])
76 | Return Value deriving Show
78data Binder
79 = BooleanBinder Bool
80 | StringBinder String
81 | NumberBinder (Either Integer Double)
82 | VarBinder String
83 | NullaryBinder String
84 | UnaryBinder String Binder
85 | ObjectBinder [(String, Binder)]
86 | ArrayBinder [Binder] (Maybe Binder) deriving Show