@@ -367,6 +367,23 @@ instantiate tcm pVal@(PrimVal (PrimInfo{primType}) tys es) ty m
367367
368368instantiate _ p _ _ = error $ " Evaluator.instantiate: Not a tylambda: " ++ show p
369369
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+
370387-- | Evaluate a case-expression
371388scrutinise :: Value -> Type -> [Alt ] -> Machine -> Machine
372389scrutinise v _altTy [] m = setTerm (valToTerm v) m
@@ -390,19 +407,11 @@ scrutinise (Lit l) _altTy alts m = case alts of
390407 1 | l1 >= ((- 2 )^ (63 :: Int )) && l1 < 2 ^ (63 :: Int ) ->
391408 Just (IntLiteral l1)
392409 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
398411 ba1 = BA. ByteArray ba0
399412 in Just (ByteArrayLiteral ba1)
400413 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
406415 ba1 = BA. ByteArray ba0
407416 in Just (ByteArrayLiteral ba1)
408417 _ -> Nothing
@@ -415,11 +424,7 @@ scrutinise (Lit l) _altTy alts m = case alts of
415424 1 | l1 >= 0 && l1 < 2 ^ (64 :: Int ) ->
416425 Just (WordLiteral l1)
417426 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
423428 ba1 = BA. ByteArray ba0
424429 in Just (ByteArrayLiteral ba1)
425430 _ -> Nothing
0 commit comments