on master help sign in
Primitives a-l done
73eb351David Christiansen
src/Core/Execute.hs+78−16
@@ -386,14 +386,6 @@ execApp' env ctxt f@(EP _ n _) args =
386 primResBool (i1 == i2)
386 primResBool (i1 == i2)
387 getOp (UN "prim__eqString") [EConstant (Str s1), EConstant (Str s2)] =
387 getOp (UN "prim__eqString") [EConstant (Str s1), EConstant (Str s2)] =
388 primResBool (s1 == s2)
388 primResBool (s1 == s2)
389− getOp (UN "prim__gtChar") [EConstant (Ch i1), EConstant (Ch i2)] =
390− primResBool (i1 > i2)
391− getOp (UN "prim__gteChar") [EConstant (Ch i1), EConstant (Ch i2)] =
392− primResBool (i1 >= i2)
393− getOp (UN "prim__gtInt") [EConstant (I i1), EConstant (I i2)] =
394− primResBool (i1 > i2)
395− getOp (UN "prim__gteInt") [EConstant (I i1), EConstant (I i2)] =
396− primResBool (i1 >= i2)
397 getOp (UN "prim__floatACos") [EConstant (Fl f)] =
389 getOp (UN "prim__floatACos") [EConstant (Fl f)] =
398 primRes Fl (acos f)
390 primRes Fl (acos f)
399 getOp (UN "prim__floatASin") [EConstant (Fl f)] =
391 getOp (UN "prim__floatASin") [EConstant (Fl f)] =
@@ -442,20 +434,90 @@ execApp' env ctxt f@(EP _ n _) args =
442 primRes BI (fromMaybe 0 $ readMay s)
434 primRes BI (fromMaybe 0 $ readMay s)
443 getOp (UN "prim__fromStrInt") [EConstant (Str s)] =
435 getOp (UN "prim__fromStrInt") [EConstant (Str s)] =
444 primRes I (fromMaybe 0 $ readMay s)
436 primRes I (fromMaybe 0 $ readMay s)
437+ getOp (UN "prim__gtB16") [EConstant (B16 x), EConstant (B16 y)] =
438+ primResBool (x > y)
439+ getOp (UN "prim__gtB32") [EConstant (B32 x), EConstant (B32 y)] =
440+ primResBool (x > y)
441+ getOp (UN "prim__gtB64") [EConstant (B64 x), EConstant (B64 y)] =
442+ primResBool (x > y)
443+ getOp (UN "prim__gtB8") [EConstant (B8 x), EConstant (B8 y)] =
444+ primResBool (x > y)
445+ getOp (UN "prim__gtBigInt") [EConstant (BI x), EConstant (BI y)] =
446+ primResBool (x > y)
447+ getOp (UN "prim__gtChar") [EConstant (Ch x), EConstant (Ch y)] =
448+ primResBool (x > y)
449+ getOp (UN "prim__gtFloat") [EConstant (Fl x), EConstant (Fl y)] =
450+ primResBool (x > y)
451+ getOp (UN "prim__gtInt") [EConstant (I x), EConstant (I y)] =
452+ primResBool (x > y)
453+ getOp (UN "prim__gteB16") [EConstant (B16 x), EConstant (B16 y)] =
454+ primResBool (x >= y)
455+ getOp (UN "prim__gteB32") [EConstant (B32 x), EConstant (B32 y)] =
456+ primResBool (x >= y)
457+ getOp (UN "prim__gteB64") [EConstant (B64 x), EConstant (B64 y)] =
458+ primResBool (x >= y)
459+ getOp (UN "prim__gteB8") [EConstant (B8 x), EConstant (B8 y)] =
460+ primResBool (x >= y)
461+ getOp (UN "prim__gteBigInt") [EConstant (BI x), EConstant (BI y)] =
462+ primResBool (x >= y)
463+ getOp (UN "prim__gteChar") [EConstant (Ch x), EConstant (Ch y)] =
464+ primResBool (x >= y)
465+ getOp (UN "prim__gteFloat") [EConstant (Fl x), EConstant (Fl y)] =
466+ primResBool (x >= y)
467+ getOp (UN "prim__gteInt") [EConstant (I x), EConstant (I y)] =
468+ primResBool (x >= y)
469+ getOp (UN "prim__intToChar") [EConstant (I i)] =
470+ primRes Ch (toEnum i)
445 getOp (UN "prim__intToFloat") [EConstant (I i)] =
471 getOp (UN "prim__intToFloat") [EConstant (I i)] =
446 primRes Fl (fromRational (toRational i))
472 primRes Fl (fromRational (toRational i))
447 getOp (UN "prim__intToStr") [EConstant (I i)] =
473 getOp (UN "prim__intToStr") [EConstant (I i)] =
448 primRes Str (show i)
474 primRes Str (show i)
449 getOp (UN "prim_lenString") [EConstant (Str s)] =
475 getOp (UN "prim_lenString") [EConstant (Str s)] =
450 primRes I (length s)
476 primRes I (length s)
477+ getOp (UN "prim__lshrB16") [EConstant (B16 i1), EConstant (B16 i2)] =
478+ primRes B16 (shiftR i1 (fromIntegral i2))
479+ getOp (UN "prim__lshrB32") [EConstant (B32 i1), EConstant (B32 i2)] =
480+ primRes B32 (shiftR i1 (fromIntegral i2))
481+ getOp (UN "prim__lshrB64") [EConstant (B64 i1), EConstant (B64 i2)] =
482+ primRes B64 (shiftR i1 (fromIntegral i2))
483+ getOp (UN "prim__lshrB8") [EConstant (B8 i1), EConstant (B8 i2)] =
484+ primRes B8 (shiftR i1 (fromIntegral i2))
485+ getOp (UN "prim__lshrBigInt") [EConstant (BI i1), EConstant (BI i2)] =
486+ primRes BI (shiftR i1 (fromIntegral i2))
487+ getOp (UN "prim__lshrInt") [EConstant (I i1), EConstant (I i2)] =
488+ primRes I (shiftR i1 i2)
489+ getOp (UN "prim__ltB16") [EConstant (B16 x), EConstant (B16 y)] =
490+ primResBool (x < y)
491+ getOp (UN "prim__ltB32") [EConstant (B32 x), EConstant (B32 y)] =
492+ primResBool (x < y)
493+ getOp (UN "prim__ltB64") [EConstant (B64 x), EConstant (B64 y)] =
494+ primResBool (x < y)
495+ getOp (UN "prim__ltB8") [EConstant (B8 x), EConstant (B8 y)] =
496+ primResBool (x < y)
497+ getOp (UN "prim__ltBigInt") [EConstant (BI x), EConstant (BI y)] =
498+ primResBool (x < y)
451− getOp (UN "prim__ltChar") [EConstant (Ch i1), EConstant (Ch i2)] =
499+ getOp (UN "prim__ltChar") [EConstant (Ch x), EConstant (Ch y)] =
500+ primResBool (x < y)
501+ getOp (UN "prim__ltFloat") [EConstant (Fl x), EConstant (Fl y)] =
452− primResBool (i1 < i2)
502+ primResBool (x < y)
503+ getOp (UN "prim__ltInt") [EConstant (I x), EConstant (I y)] =
504+ primResBool (x < y)
505+ getOp (UN "prim__lteB16") [EConstant (B16 x), EConstant (B16 y)] =
506+ primResBool (x <= y)
507+ getOp (UN "prim__lteB32") [EConstant (B32 x), EConstant (B32 y)] =
508+ primResBool (x <= y)
509+ getOp (UN "prim__lteB64") [EConstant (B64 x), EConstant (B64 y)] =
510+ primResBool (x <= y)
511+ getOp (UN "prim__lteB8") [EConstant (B8 x), EConstant (B8 y)] =
512+ primResBool (x <= y)
513+ getOp (UN "prim__lteBigInt") [EConstant (BI x), EConstant (BI y)] =
514+ primResBool (x <= y)
453− getOp (UN "prim__lteChar") [EConstant (Ch i1), EConstant (Ch i2)] =
515+ getOp (UN "prim__lteChar") [EConstant (Ch x), EConstant (Ch y)] =
454− primResBool (i1 <= i2)
516+ primResBool (x <= y)
517+ getOp (UN "prim__lteFloat") [EConstant (Fl x), EConstant (Fl y)] =
518+ primResBool (x <= y)
455− getOp (UN "prim__lteInt") [EConstant (I i1), EConstant (I i2)] =
519+ getOp (UN "prim__lteInt") [EConstant (I x), EConstant (I y)] =
456− primResBool (i1 <= i2)
520+ primResBool (x <= y)
457− getOp (UN "prim__ltInt") [EConstant (I i1), EConstant (I i2)] =
458− primResBool (i1 < i2)
459 getOp (UN "prim__modInt") [EConstant (I i1), EConstant (I i2)] =
521 getOp (UN "prim__modInt") [EConstant (I i1), EConstant (I i2)] =
460 primRes I (i1 `mod` i2)
522 primRes I (i1 `mod` i2)
461 getOp (UN "prim__mulBigInt") [EConstant (BI i1), EConstant (BI i2)] =
523 getOp (UN "prim__mulBigInt") [EConstant (BI i1), EConstant (BI i2)] =