module Distribution.Types.PackageName
( PackageName, unPackageName, mkPackageName
) where
import Prelude ()
import Distribution.Compat.Prelude
import Distribution.Utils.ShortText
import qualified Text.PrettyPrint as Disp
import Distribution.Pretty
import Distribution.Parsec
newtype PackageName = PackageName ShortText
deriving (Generic, Read, Show, Eq, Ord, Typeable, Data)
unPackageName :: PackageName -> String
unPackageName (PackageName s) = fromShortText s
mkPackageName :: String -> PackageName
mkPackageName = PackageName . toShortText
instance IsString PackageName where
fromString = mkPackageName
instance Binary PackageName
instance Pretty PackageName where
pretty = Disp.text . unPackageName
instance Parsec PackageName where
parsec = mkPackageName <$> parsecUnqualComponentName
instance NFData PackageName where
rnf (PackageName pkg) = rnf pkg