Permalink
Browse files

* .Str for #18

  • Loading branch information...
1 parent 2877e1d commit b1f0f2062b2d9f1b4ee7008cf037d8203317e883 @audreyt audreyt committed Jul 17, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 Pugs/src/Pugs/Prim.hs
View
@@ -110,6 +110,7 @@ op0 "Num" = const $ return (VType $ mkType "Num")
op0 "Rat" = const $ return (VType $ mkType "Rat")
op0 "Bool" = const $ return (VType $ mkType "Bool")
op0 "Complex" = const $ return (VType $ mkType "Complex")
+op0 "Str" = const $ return (VType $ mkType "Str")
op0 other = const $ fail ("Unimplemented listOp: " ++ other)
-- |Implementation of unary primitive operators and functions
@@ -227,6 +228,7 @@ op1 "Int" = op1Cast VInt
op1 "Num" = op1Cast VNum
op1 "Rat" = op1Cast VRat
op1 "Complex" = op1Cast VComplex
+op1 "Str" = op1Cast VStr
op1 "+^" = op1Cast (VInt . pred . negate) -- Arbitrary precision complement- 0 ==> -1 / 1 ==> -2
op1 "~^" = op1Cast (VStr . mapStr complement)
op1 "?^" = op1 "!"
@@ -1924,6 +1926,8 @@ initSyms = seq (length syms) $ do
\\n Complex pre Complex safe (Rat)\
\\n Complex pre Complex safe (Bool)\
\\n Complex pre Complex safe (Complex)\
+\\n Str pre Str safe ()\
+\\n Str pre Str safe (Str)\
\\n Rat pre Rat safe ()\
\\n Rat pre Rat safe (Int)\
\\n Rat pre Rat safe (Int: Any)\

0 comments on commit b1f0f20

Please sign in to comment.