Changeset 4 for src/Prim.hs

Show
Ignore:
Timestamp:
02/06/05 20:01:10 (4 years ago)
Author:
autrijus
svk:copy_cache_prev:
1041
Message:

* This be 6.0.0.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Prim.hs

    r1 r4  
    1313 
    1414module Prim where 
     15import Internals 
    1516import AST 
    16 import Data.Char 
    17 import Data.Bits 
    18 import Data.Word 
    19 import Data.List 
    20 import Data.Maybe 
    21 import Data.Ratio 
    2217 
    2318op1 :: Ident -> (forall a. Context a => a) -> Val 
    24 op1 "!"  = VBool . not 
     19op1 "!"  = \x -> case op1 "?" x of 
     20    VBool True  -> VBool False 
     21    VBool False -> VBool True 
    2522op1 "+"  = op1Numeric id 
    2623op1 "-"  = op1Numeric negate 
     
    154151op1Numeric f VUndef     = VInt $ f 0 
    155152op1Numeric f (VInt x)   = VInt $ f x 
     153op1Numeric f (VList l)  = VInt $ f $ genericLength l 
    156154op1Numeric f x          = VNum $ f (vCast x) 
    157155