Permalink
Browse files

Add a couple of NFData instances

The Hackage2 server wants them
  • Loading branch information...
igfoo committed Aug 23, 2012
1 parent b1bc941 commit ffa24d512efb849b0daf1ac87401935d2e9793f2
Showing with 8 additions and 0 deletions.
  1. +1 −0 Cabal/Cabal.cabal
  2. +7 −0 Cabal/Distribution/Package.hs
View
@@ -41,6 +41,7 @@ Flag bytestring-in-base
Library
build-depends: base >= 2 && < 5,
+ deepseq >= 1.3 && < 1.4,
filepath >= 1 && < 1.4
if flag(base4) { build-depends: base >= 4 } else { build-depends: base < 4 }
if flag(base3) { build-depends: base >= 3 } else { build-depends: base < 3 }
@@ -70,6 +70,7 @@ import qualified Distribution.Compat.ReadP as Parse
import Distribution.Compat.ReadP ((<++))
import qualified Text.PrettyPrint as Disp
import Text.PrettyPrint ((<>), (<+>), text)
+import Control.DeepSeq (NFData(..))
import qualified Data.Char as Char ( isDigit, isAlphaNum )
import Data.List ( intersperse )
@@ -88,6 +89,9 @@ instance Text PackageName where
-- each component must contain an alphabetic character, to avoid
-- ambiguity in identifiers like foo-1 (the 1 is the version number).
+instance NFData PackageName where
+ rnf (PackageName pkg) = rnf pkg
+
-- | Type alias so we can use the shorter name PackageId.
type PackageId = PackageIdentifier
@@ -109,6 +113,9 @@ instance Text PackageIdentifier where
v <- (Parse.char '-' >> parse) <++ return (Version [] [])
return (PackageIdentifier n v)
+instance NFData PackageIdentifier where
+ rnf (PackageIdentifier name version) = rnf name `seq` rnf version
+
-- ------------------------------------------------------------
-- * Installed Package Ids
-- ------------------------------------------------------------

0 comments on commit ffa24d5

Please sign in to comment.