Skip to content
This repository was archived by the owner on Feb 3, 2021. It is now read-only.

Commit 2877e1d

Browse files
committed
* Implement .Complex for #17
1 parent 2ffbe10 commit 2877e1d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Pugs/src/Pugs/Prim.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ op0 "Int" = const $ return (VType $ mkType "Int")
109109
op0 "Num" = const $ return (VType $ mkType "Num")
110110
op0 "Rat" = const $ return (VType $ mkType "Rat")
111111
op0 "Bool" = const $ return (VType $ mkType "Bool")
112+
op0 "Complex" = const $ return (VType $ mkType "Complex")
112113
op0 other = const $ fail ("Unimplemented listOp: " ++ other)
113114

114115
-- |Implementation of unary primitive operators and functions
@@ -225,6 +226,7 @@ op1 "int" = op1Cast VInt
225226
op1 "Int" = op1Cast VInt
226227
op1 "Num" = op1Cast VNum
227228
op1 "Rat" = op1Cast VRat
229+
op1 "Complex" = op1Cast VComplex
228230
op1 "+^" = op1Cast (VInt . pred . negate) -- Arbitrary precision complement- 0 ==> -1 / 1 ==> -2
229231
op1 "~^" = op1Cast (VStr . mapStr complement)
230232
op1 "?^" = op1 "!"
@@ -1916,6 +1918,12 @@ initSyms = seq (length syms) $ do
19161918
\\n Num pre Num safe (Num)\
19171919
\\n Num pre Num safe (Rat)\
19181920
\\n Num pre Num safe (Bool)\
1921+
\\n Complex pre Complex safe ()\
1922+
\\n Complex pre Complex safe (Int)\
1923+
\\n Complex pre Complex safe (Num)\
1924+
\\n Complex pre Complex safe (Rat)\
1925+
\\n Complex pre Complex safe (Bool)\
1926+
\\n Complex pre Complex safe (Complex)\
19191927
\\n Rat pre Rat safe ()\
19201928
\\n Rat pre Rat safe (Int)\
19211929
\\n Rat pre Rat safe (Int: Any)\

0 commit comments

Comments
 (0)