mirror of
https://github.com/github/semantic.git
synced 2024-12-18 12:21:57 +03:00
use Data.Scientific to convert digit
This commit is contained in:
parent
51e19ee242
commit
6b99b321ce
@ -19,7 +19,7 @@ import qualified Data.Abstract.Number as Number
|
|||||||
import Data.Bits
|
import Data.Bits
|
||||||
import Data.Coerce
|
import Data.Coerce
|
||||||
import Data.List (genericIndex, genericLength)
|
import Data.List (genericIndex, genericLength)
|
||||||
import Data.Scientific (Scientific)
|
import Data.Scientific (Scientific, coefficient)
|
||||||
import Data.Scientific.Exts
|
import Data.Scientific.Exts
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
import Data.Word
|
import Data.Word
|
||||||
@ -158,6 +158,7 @@ instance ( Coercible body (Eff effects)
|
|||||||
, Member (Resumable (BaseError (ValueError address body))) effects
|
, Member (Resumable (BaseError (ValueError address body))) effects
|
||||||
, Member (Resumable (BaseError (AddressError address (Value address body)))) effects
|
, Member (Resumable (BaseError (AddressError address (Value address body)))) effects
|
||||||
, Member (State (Heap address (Value address body))) effects
|
, Member (State (Heap address (Value address body))) effects
|
||||||
|
, Member Trace effects
|
||||||
, Ord address
|
, Ord address
|
||||||
, Show address
|
, Show address
|
||||||
)
|
)
|
||||||
@ -272,6 +273,7 @@ instance ( Coercible body (Eff effects)
|
|||||||
|
|
||||||
liftBitwise2 operator left right
|
liftBitwise2 operator left right
|
||||||
| (Integer (Number.Integer i), Integer (Number.Integer j)) <- pair = pure . integer $ operator i j
|
| (Integer (Number.Integer i), Integer (Number.Integer j)) <- pair = pure . integer $ operator i j
|
||||||
|
| (Float (Number.Decimal i), Float (Number.Decimal j)) <- pair = pure . integer $ operator (coefficient (normalize i)) (coefficient (normalize j))
|
||||||
| otherwise = throwValueError (Bitwise2Error left right)
|
| otherwise = throwValueError (Bitwise2Error left right)
|
||||||
where pair = (left, right)
|
where pair = (left, right)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user