Commit 7b93d945 authored by ijones's avatar ijones
Browse files

some comments for Package.hs

parent 70591573
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- Stability : alpha -- Stability : alpha
-- Portability : portable -- Portability : portable
-- --
-- Packages. -- Packages are fundamentally just a name and a version.
{- All rights reserved. {- All rights reserved.
...@@ -49,13 +49,15 @@ import Distribution.Compat.ReadP as ReadP ...@@ -49,13 +49,15 @@ import Distribution.Compat.ReadP as ReadP
import Data.Char ( isDigit, isAlphaNum ) import Data.Char ( isDigit, isAlphaNum )
import Data.List ( intersperse ) import Data.List ( intersperse )
-- | The name and version of a package.
data PackageIdentifier data PackageIdentifier
= PackageIdentifier { = PackageIdentifier {
pkgName :: String, pkgName :: String, -- ^The name of this package, eg. foo
pkgVersion :: Version pkgVersion :: Version -- ^the version of this package, eg 1.2
} }
deriving (Read, Show, Eq, Ord) deriving (Read, Show, Eq, Ord)
-- |Creates a string like foo-1.2
showPackageId :: PackageIdentifier -> String showPackageId :: PackageIdentifier -> String
showPackageId (PackageIdentifier n (Version [] _)) = n -- if no version, don't show version. showPackageId (PackageIdentifier n (Version [] _)) = n -- if no version, don't show version.
showPackageId pkgid = showPackageId pkgid =
...@@ -70,6 +72,7 @@ parsePackageName = do ns <- sepBy1 component (char '-') ...@@ -70,6 +72,7 @@ parsePackageName = do ns <- sepBy1 component (char '-')
-- each component must contain an alphabetic character, to avoid -- each component must contain an alphabetic character, to avoid
-- ambiguity in identifiers like foo-1 (the 1 is the version number). -- ambiguity in identifiers like foo-1 (the 1 is the version number).
-- |A package ID looks like foo-1.2.
parsePackageId :: ReadP r PackageIdentifier parsePackageId :: ReadP r PackageIdentifier
parsePackageId = do parsePackageId = do
n <- parsePackageName n <- parsePackageName
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment