Skip to content

Commit

Permalink
cosmetics in ‘Stack.Types.PackageIdentifier’
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkkrp committed Nov 5, 2015
1 parent 29f082a commit ce50196
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions src/Stack/Types/PackageIdentifier.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@
-- | Package identifier (name-version).

module Stack.Types.PackageIdentifier
(PackageIdentifier(..)
,toTuple
,fromTuple
,parsePackageIdentifier
,parsePackageIdentifierFromString
,packageIdentifierVersion
,packageIdentifierName
,packageIdentifierParser
,packageIdentifierString
,packageIdentifierText)
( PackageIdentifier(..)
, toTuple
, fromTuple
, parsePackageIdentifier
, parsePackageIdentifierFromString
, packageIdentifierParser
, packageIdentifierString
, packageIdentifierText )
where

import Control.Applicative
Expand Down Expand Up @@ -46,10 +44,12 @@ instance Show PackageIdentifierParseFail where
instance Exception PackageIdentifierParseFail

-- | A pkg-ver combination.
data PackageIdentifier =
PackageIdentifier !PackageName
!Version
deriving (Eq,Ord,Generic,Data,Typeable)
data PackageIdentifier = PackageIdentifier
{ -- | Get the name part of the identifier.
packageIdentifierName :: !PackageName
-- | Get the version part of the identifier.
, packageIdentifierVersion :: !Version
} deriving (Eq,Ord,Generic,Data,Typeable)

instance NFData PackageIdentifier where
rnf (PackageIdentifier !p !v) =
Expand Down Expand Up @@ -78,14 +78,6 @@ toTuple (PackageIdentifier n v) = (n,v)
fromTuple :: (PackageName,Version) -> PackageIdentifier
fromTuple (n,v) = PackageIdentifier n v

-- | Get the version part of the identifier.
packageIdentifierVersion :: PackageIdentifier -> Version
packageIdentifierVersion (PackageIdentifier _ ver) = ver

-- | Get the name part of the identifier.
packageIdentifierName :: PackageIdentifier -> PackageName
packageIdentifierName (PackageIdentifier name _) = name

-- | A parser for a package-version pair.
packageIdentifierParser :: Parser PackageIdentifier
packageIdentifierParser =
Expand Down

0 comments on commit ce50196

Please sign in to comment.