@@ -29,6 +29,7 @@ data PackageIdentifier = PackageIdentifier
2929  , pkgVersion  ::  Version 
3030  --  ^  the version of this package, eg 1.2 
3131  , pkgCompiler  ::  Maybe   CompilerId 
32+   --  ^  the associated compiler id of the package, eg ghc-9.8.4 
3233  } 
3334  deriving  (Generic , Read , Show , Eq , Ord , Data )
3435
@@ -37,8 +38,9 @@ instance Structured PackageIdentifier
3738
3839instance  Pretty  PackageIdentifier  where 
3940  pretty (PackageIdentifier  n v c)
40-     |  v ==  nullVersion =  pretty c <<>>  Disp. char ' -'   <<>>  pretty n --  if no version, don't show version.
41-     |  Just  c' <-  c =  pretty c' <<>>  Disp. char ' -'   <<>>  pretty n <<>>  Disp. char ' -'   <<>>  pretty v
41+     |  Just  c' <-  c, v ==  nullVersion =  pretty c <<>>  Disp. char ' :'   <<>>  pretty n --  if no version, don't show version.
42+     |  Just  c' <-  c =  pretty c' <<>>  Disp. char ' :'   <<>>  pretty n <<>>  Disp. char ' -'   <<>>  pretty v
43+     |  v ==  nullVersion =  pretty n
4244    |  otherwise  =  pretty n <<>>  Disp. char ' -'   <<>>  pretty v
4345
4446--  | 
@@ -64,13 +66,13 @@ instance Pretty PackageIdentifier where
6466--  Nothing 
6567instance  Parsec  PackageIdentifier  where 
6668  parsec =  do 
67-     comp <-  parsec <*  P. char ' - ' 
69+     --   comp <- Just <$> ( parsec <* P.char ':') <|> return Nothing 
6870    xs' <-  P. sepByNonEmpty component (P. char ' -'  )
6971    (v, xs) <-  case  simpleParsec (NE. last  xs') of 
7072      Nothing  ->  return  (nullVersion, toList xs') --  all components are version
7173      Just  v ->  return  (v, NE. init  xs')
7274    if  not  (null  xs) &&  all  (\ c ->  all  (/=  ' .'  ) c &&  not  (all  isDigit c)) xs
73-       then  return  $  PackageIdentifier  (mkPackageName (intercalate " -"   xs)) v comp
75+       then  return  $  PackageIdentifier  (mkPackageName (intercalate " -"   xs)) v Nothing   -- comp
7476      else  fail  " all digits or a dot in a portion of package name" 
7577    where 
7678      component =  P. munch1 (\ c ->  isAlphaNum c ||  c ==  ' .'  )
0 commit comments