@@ -18,7 +18,7 @@ import IRTS.System (getIdrisLibDir)
1818
1919import Control.Applicative ((<$>))
2020import Control.Monad.State.Strict
21−import Data.Char (isDigit, isLower)
21+import Data.Char (isDigit, isAlpha, toLower)
2222import Data.List (isSuffixOf)
2323import System.Directory
2424import System.FilePath
@@ -26,8 +26,15 @@ import System.FilePath
2626data IFileType = IDR FilePath | LIDR FilePath | IBC FilePath IFileType
2727 deriving (Show, Eq)
2828
29−newtype PkgName = PkgName { unPkgName :: String }
30− deriving (Show, Eq)
29+newtype PkgName = PkgName String
30+
31+unPkgName :: PkgName -> String
32+unPkgName (PkgName s) = map toLower s
33+
34+instance Show PkgName where
35+ show (PkgName pkg) = pkg
36+instance Eq PkgName where
37+ a == b = unPkgName a == unPkgName b
3138
3239unInitializedPkgName :: PkgName
3340unInitializedPkgName = PkgName ""
@@ -35,10 +42,10 @@ unInitializedPkgName = PkgName ""
3542pkgName :: String -> Either String PkgName
3643pkgName "" = Left "empty package name"
3744pkgName s@(f:l)
38− | not $ isLower f =
39− Left "package name need to start by a lower alpha"
40− | not $ all (\c -> isLower c || isDigit c || c `elem` "-_") l =
41− Left "package name need to contain only lower alpha, digits, and -_"
45+ | not $ isAlpha f =
46+ Left "package name need to start by a letter"
47+ | not $ all (\c -> isAlpha c || isDigit c || c `elem` "-_") l =
48+ Left "package name need to contain only letter, digits, and -_"
4249 | otherwise = Right $ PkgName s
4350
4451-- | Get the index file name for a package name