@@ -367,6 +367,23 @@ instantiate tcm pVal@(PrimVal (PrimInfo{primType}) tys es) ty m
367
367
368
368
instantiate _ p _ _ = error $ " Evaluator.instantiate: Not a tylambda: " ++ show p
369
369
370
+ getByteArrayIP :: Integer -> BA. ByteArray#
371
+ #if MIN_VERSION_base(4,15,0)
372
+ getByteArrayIP ! (IP ba0) = ba0
373
+ #else
374
+ getByteArrayIP ! (Jp # ! (BN # ba0)) = ba0
375
+ #endif
376
+ getByteArrayIP _ = error " getByteArrayIP: not IP"
377
+
378
+ getByteArrayIN :: Integer -> BA. ByteArray#
379
+ #if MIN_VERSION_base(4,15,0)
380
+ getByteArrayIN ! (IN ba0) = ba0
381
+ #else
382
+ getByteArrayIN ! (Jn # ! (BN # ba0)) = ba0
383
+ #endif
384
+ getByteArrayIN _ = error " getByteArrayIN: not IN"
385
+
386
+
370
387
-- | Evaluate a case-expression
371
388
scrutinise :: Value -> Type -> [Alt ] -> Machine -> Machine
372
389
scrutinise v _altTy [] m = setTerm (valToTerm v) m
@@ -390,19 +407,11 @@ scrutinise (Lit l) _altTy alts m = case alts of
390
407
1 | l1 >= ((- 2 )^ (63 :: Int )) && l1 < 2 ^ (63 :: Int ) ->
391
408
Just (IntLiteral l1)
392
409
2 | l1 >= (2 ^ (63 :: Int )) ->
393
- #if MIN_VERSION_base(4,15,0)
394
- let ! (IP ba0) = l1
395
- #else
396
- let ! (Jp # ! (BN # ba0)) = l1
397
- #endif
410
+ let ba0 = getByteArrayIP l1
398
411
ba1 = BA. ByteArray ba0
399
412
in Just (ByteArrayLiteral ba1)
400
413
3 | l1 < ((- 2 )^ (63 :: Int )) ->
401
- #if MIN_VERSION_base(4,15,0)
402
- let ! (IN ba0) = l1
403
- #else
404
- let ! (Jn # ! (BN # ba0)) = l1
405
- #endif
414
+ let ba0 = getByteArrayIN l1
406
415
ba1 = BA. ByteArray ba0
407
416
in Just (ByteArrayLiteral ba1)
408
417
_ -> Nothing
@@ -415,11 +424,7 @@ scrutinise (Lit l) _altTy alts m = case alts of
415
424
1 | l1 >= 0 && l1 < 2 ^ (64 :: Int ) ->
416
425
Just (WordLiteral l1)
417
426
2 | l1 >= (2 ^ (64 :: Int )) ->
418
- #if MIN_VERSION_base(4,15,0)
419
- let ! (IP ba0) = l1
420
- #else
421
- let ! (Jp # ! (BN # ba0)) = l1
422
- #endif
427
+ let ba0 = getByteArrayIP l1
423
428
ba1 = BA. ByteArray ba0
424
429
in Just (ByteArrayLiteral ba1)
425
430
_ -> Nothing
0 commit comments