Permalink
Browse files

Add some Typeable instances used by the Hackage 2 server

  • Loading branch information...
1 parent 43af8a4 commit 1a8fb83e2a2959e1c64d93750f24599efe115f17 @igfoo igfoo committed Aug 23, 2012
Showing with 10 additions and 4 deletions.
  1. +4 −2 Cabal/Distribution/Package.hs
  2. +3 −1 Cabal/Distribution/PackageDescription.hs
  3. +3 −1 Cabal/Distribution/Version.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Package
@@ -73,9 +74,10 @@ import Text.PrettyPrint ((<>), (<+>), text)
import Control.DeepSeq (NFData(..))
import qualified Data.Char as Char ( isDigit, isAlphaNum )
import Data.List ( intersperse )
+import Data.Typeable ( Typeable )
newtype PackageName = PackageName String
- deriving (Read, Show, Eq, Ord)
+ deriving (Read, Show, Eq, Ord, Typeable)
instance Text PackageName where
disp (PackageName n) = Disp.text n
@@ -101,7 +103,7 @@ data PackageIdentifier
pkgName :: PackageName, -- ^The name of this package, eg. foo
pkgVersion :: Version -- ^the version of this package, eg 1.2
}
- deriving (Read, Show, Eq, Ord)
+ deriving (Read, Show, Eq, Ord, Typeable)
instance Text PackageIdentifier where
disp (PackageIdentifier n v) = case v of
@@ -1,3 +1,4 @@
+{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.PackageDescription
@@ -126,6 +127,7 @@ module Distribution.PackageDescription (
import Data.List (nub, intersperse)
import Data.Maybe (maybeToList)
import Data.Monoid (Monoid(mempty, mappend))
+import Data.Typeable ( Typeable )
import Control.Monad (MonadPlus(mplus))
import Text.PrettyPrint as Disp
import qualified Distribution.Compat.ReadP as Parse
@@ -952,7 +954,7 @@ data GenericPackageDescription =
condTestSuites :: [(String, CondTree ConfVar [Dependency] TestSuite)],
condBenchmarks :: [(String, CondTree ConfVar [Dependency] Benchmark)]
}
- deriving (Show, Eq)
+ deriving (Show, Eq, Typeable)
instance Package GenericPackageDescription where
packageId = packageId . packageDescription
@@ -1,3 +1,4 @@
+{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Version
@@ -91,6 +92,7 @@ module Distribution.Version (
) where
+import Data.Typeable ( Typeable )
import Data.Version ( Version(..) )
import Distribution.Text ( Text(..) )
@@ -116,7 +118,7 @@ data VersionRange
| UnionVersionRanges VersionRange VersionRange
| IntersectVersionRanges VersionRange VersionRange
| VersionRangeParens VersionRange -- just '(exp)' parentheses syntax
- deriving (Show,Read,Eq)
+ deriving (Show,Read,Eq,Typeable)
{-# DEPRECATED AnyVersion "Use 'anyVersion', 'foldVersionRange' or 'asVersionIntervals'" #-}
{-# DEPRECATED ThisVersion "use 'thisVersion', 'foldVersionRange' or 'asVersionIntervals'" #-}

0 comments on commit 1a8fb83

Please sign in to comment.