Skip to content

Commit

Permalink
➖ Remove call-stack dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
lsrcz committed Sep 28, 2023
1 parent 387387a commit 40e9032
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
3 changes: 0 additions & 3 deletions grisette.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ library
, array >=0.5.4 && <0.6
, base >=4.14 && <5
, bytestring >=0.10.12 && <0.12
, call-stack >=0.1 && <0.5
, deepseq >=1.4.4 && <1.5
, generic-deriving >=1.14.1 && <1.15
, hashable >=1.2.3 && <1.5
Expand Down Expand Up @@ -168,7 +167,6 @@ test-suite doctest
, array >=0.5.4 && <0.6
, base >=4.14 && <5
, bytestring >=0.10.12 && <0.12
, call-stack >=0.1 && <0.5
, deepseq >=1.4.4 && <1.5
, doctest >=0.18.2 && <0.22
, generic-deriving >=1.14.1 && <1.15
Expand Down Expand Up @@ -221,7 +219,6 @@ test-suite spec
, array >=0.5.4 && <0.6
, base >=4.14 && <5
, bytestring >=0.10.12 && <0.12
, call-stack >=0.1 && <0.5
, deepseq >=1.4.4 && <1.5
, generic-deriving >=1.14.1 && <1.15
, grisette
Expand Down
1 change: 0 additions & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ dependencies:
- hashtables >= 1.2.3.4 && < 1.4
- loch-th >= 0.2.2 && < 0.3
- th-compat >= 0.1.2 && < 0.2
- call-stack >= 0.1 && < 0.5
- array >= 0.5.4 && < 0.6
- sbv >= 8.11 && < 10.3
- parallel >= 3.2.2.0 && < 3.3
Expand Down
11 changes: 5 additions & 6 deletions src/Grisette/Core/Data/BV.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ import Data.Bits
),
FiniteBits (countLeadingZeros, countTrailingZeros, finiteBitSize),
)
import Data.CallStack (HasCallStack)
import Data.Hashable (Hashable (hashWithSalt))
import Data.Maybe (fromMaybe, isJust)
import Data.Proxy (Proxy (Proxy))
Expand Down Expand Up @@ -149,29 +148,29 @@ newtype WordN (n :: Nat) = WordN {unWordN :: Integer}
data SomeWordN where
SomeWordN :: (KnownNat n, 1 <= n) => WordN n -> SomeWordN

unarySomeWordN :: (HasCallStack) => (forall n. (KnownNat n, 1 <= n) => WordN n -> r) -> SomeWordN -> r
unarySomeWordN :: (forall n. (KnownNat n, 1 <= n) => WordN n -> r) -> SomeWordN -> r
unarySomeWordN op (SomeWordN (w :: WordN w)) = op w
{-# INLINE unarySomeWordN #-}

unarySomeWordNR1 :: (HasCallStack) => (forall n. (KnownNat n, 1 <= n) => WordN n -> WordN n) -> SomeWordN -> SomeWordN
unarySomeWordNR1 :: (forall n. (KnownNat n, 1 <= n) => WordN n -> WordN n) -> SomeWordN -> SomeWordN
unarySomeWordNR1 op (SomeWordN (w :: WordN w)) = SomeWordN $ op w
{-# INLINE unarySomeWordNR1 #-}

binSomeWordN :: (HasCallStack) => (forall n. (KnownNat n, 1 <= n) => WordN n -> WordN n -> r) -> SomeWordN -> SomeWordN -> r
binSomeWordN :: (forall n. (KnownNat n, 1 <= n) => WordN n -> WordN n -> r) -> SomeWordN -> SomeWordN -> r
binSomeWordN op (SomeWordN (l :: WordN l)) (SomeWordN (r :: WordN r)) =
case sameNat (Proxy @l) (Proxy @r) of
Just Refl -> op l r
Nothing -> throw BitwidthMismatch
{-# INLINE binSomeWordN #-}

binSomeWordNR1 :: (HasCallStack) => (forall n. (KnownNat n, 1 <= n) => WordN n -> WordN n -> WordN n) -> SomeWordN -> SomeWordN -> SomeWordN
binSomeWordNR1 :: (forall n. (KnownNat n, 1 <= n) => WordN n -> WordN n -> WordN n) -> SomeWordN -> SomeWordN -> SomeWordN
binSomeWordNR1 op (SomeWordN (l :: WordN l)) (SomeWordN (r :: WordN r)) =
case sameNat (Proxy @l) (Proxy @r) of
Just Refl -> SomeWordN $ op l r
Nothing -> throw BitwidthMismatch
{-# INLINE binSomeWordNR1 #-}

binSomeWordNR2 :: (HasCallStack) => (forall n. (KnownNat n, 1 <= n) => WordN n -> WordN n -> (WordN n, WordN n)) -> SomeWordN -> SomeWordN -> (SomeWordN, SomeWordN)
binSomeWordNR2 :: (forall n. (KnownNat n, 1 <= n) => WordN n -> WordN n -> (WordN n, WordN n)) -> SomeWordN -> SomeWordN -> (SomeWordN, SomeWordN)
binSomeWordNR2 op (SomeWordN (l :: WordN l)) (SomeWordN (r :: WordN r)) =
case sameNat (Proxy @l) (Proxy @r) of
Just Refl ->
Expand Down

0 comments on commit 40e9032

Please sign in to comment.