Changeset 5388

Show
Ignore:
Timestamp:
07/11/05 04:25:46 (3 years ago)
Author:
mugwump
svk:copy_cache_prev:
7349
Message:

Make otherwise condition a failure, not silently returning 0 ;)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Prim/Numeric.hs

    r5387 r5388  
    3939op1Round :: (Double -> Integer) -> Val -> Eval Val 
    4040op1Round f v = do 
    41     return $ VInt $ case v of 
    42        VInt i -> i 
    43        VRat r -> f ((fromRational r)::Double) 
    44        VNum n -> f n 
    45        _      -> 0 
     41    case v of 
     42       VInt i -> return $ VInt $ i 
     43       VRat r -> return $ VInt $ f ((fromRational r)::Double) 
     44       VNum n -> return $ VInt $ f n 
     45       _      -> fail "Can't round non-numeric value(?)" 
    4646 
    4747op1Numeric :: (forall a. (Num a) => a -> a) -> Val -> Eval Val