Skip to content

Commit

Permalink
Add NFData instance (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boarders authored and IagoAbal committed Jun 14, 2020
1 parent 0aff564 commit 5858ac3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions bv.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ Library
if flag(dev)
ghc-options: -Werror
Extensions: CPP
Other-Extensions: BangPatterns, DeriveDataTypeable, MagicHash
Build-depends: base >=4.6 && <5
Other-Extensions: BangPatterns, DeriveDataTypeable, MagicHash,
DeriveGeneric, DeriveAnyClass
Build-depends: base >=4.6 && <5,
deepseq
if impl(ghc) && flag(gmp)
Build-depends: integer-gmp >=0.5.1,
ghc-prim
Expand Down
6 changes: 5 additions & 1 deletion src/Data/BitVector.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}

-- NOTE: defined(MIN_VERSION_integer_gmp) == package configured with -fgmp

Expand Down Expand Up @@ -88,6 +90,7 @@ module Data.BitVector
, showHex
) where

import Control.DeepSeq ( NFData )
import Control.Monad ( Monad(..), when )
import Control.Exception ( assert )

Expand All @@ -98,6 +101,7 @@ import Data.Data ( Data )
import qualified Data.List as List
import Data.Monoid ( Monoid(..) )
import Data.Ord
import GHC.Generics ( Generic )
#ifdef __GLASGOW_HASKELL__
import qualified Text.Read as R
#endif
Expand Down Expand Up @@ -140,7 +144,7 @@ data BV
size :: !Int -- ^ The /size/ of a bit-vector.
, nat :: !Integer -- ^ The value of a bit-vector, as a natural number.
}
deriving (Data,Typeable)
deriving (Data,Generic,Typeable, NFData)

-- | An alias for 'BV'.
type BitVector = BV
Expand Down

0 comments on commit 5858ac3

Please sign in to comment.