arch-hs-0.7.0.0: Distribute hackage packages to archlinux
Copyright(c) 2020-2021 berberman
LicenseMIT
Maintainerberberman <berberman@yandex.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Distribution.ArchHs.Name

Description

Naming conversion between haskell package in hackage and archlinux community repo.

To distribute a haskell package to archlinux, the name of package should be changed according to the naming convention:

  1. for haskell libraries, their names must have haskell- prefix
  2. for programs, it depends on circumstances
  3. names should always be in lower case

However, it's not enough to prefix the string with haskell- and trasform to lower case; in some special situations, the hackage name may have haskell- prefix already, or the case is irregular, thus we have to a name preset, NAME_PRESET.json, manually. Once a package distributed to archlinux, whose name conform to above-mentioned situation, the name preset should be upgraded correspondingly.

NAME_PRESET.json will be loaded during the compilation, generating haskell code to be called in runtime.

Converting a archlinux community name to hackage name following these steps:

  1. Find if the name preset contains this rule
  2. If it contains, then use it; or remove the haskell- prefix

Converting a hackage name to archlinux community name following these steps:

  1. Find if the name preset contains this rule
  2. If it contains, then use it; or add the haskell- prefix

For details, see the type MyName and type class HasMyName with its instances.

Synopsis

Documentation

data MyName a Source #

A general package name representation. It has a phantom a, which indexes this name. Normally, the index should be the data kinds of NameRep.

In Cabal API, packages' names are represented by the type PackageName; in arch-hs, names parsed from community.db are represented by the type ArchLinuxName. It would be tedious to use two converting functions everywhere, so here comes a intermediate data type to unify them, with type level constraints as bonus.

Instances

Instances details
Eq (MyName a) Source # 
Instance details

Defined in Distribution.ArchHs.Name

Methods

(==) :: MyName a -> MyName a -> Bool #

(/=) :: MyName a -> MyName a -> Bool #

Ord (MyName a) Source # 
Instance details

Defined in Distribution.ArchHs.Name

Methods

compare :: MyName a -> MyName a -> Ordering #

(<) :: MyName a -> MyName a -> Bool #

(<=) :: MyName a -> MyName a -> Bool #

(>) :: MyName a -> MyName a -> Bool #

(>=) :: MyName a -> MyName a -> Bool #

max :: MyName a -> MyName a -> MyName a #

min :: MyName a -> MyName a -> MyName a #

Read (MyName a) Source # 
Instance details

Defined in Distribution.ArchHs.Name

Show (MyName a) Source # 
Instance details

Defined in Distribution.ArchHs.Name

Methods

showsPrec :: Int -> MyName a -> ShowS #

show :: MyName a -> String #

showList :: [MyName a] -> ShowS #

IsString (MyName a) Source # 
Instance details

Defined in Distribution.ArchHs.Name

Methods

fromString :: String -> MyName a #

Generic (MyName a) Source # 
Instance details

Defined in Distribution.ArchHs.Name

Associated Types

type Rep (MyName a) :: Type -> Type #

Methods

from :: MyName a -> Rep (MyName a) x #

to :: Rep (MyName a) x -> MyName a #

NFData (MyName a) Source # 
Instance details

Defined in Distribution.ArchHs.Name

Methods

rnf :: MyName a -> () #

HasMyName (MyName 'ArchLinuxRep) Source # 
Instance details

Defined in Distribution.ArchHs.Name

HasMyName (MyName 'HackageRep) Source # 
Instance details

Defined in Distribution.ArchHs.Name

type Rep (MyName a) Source # 
Instance details

Defined in Distribution.ArchHs.Name

type Rep (MyName a) = D1 ('MetaData "MyName" "Distribution.ArchHs.Name" "arch-hs-0.7.0.0-3VBe7H60aJ44505SscurdU" 'True) (C1 ('MetaCons "MyName" 'PrefixI 'True) (S1 ('MetaSel ('Just "unsafeUnMyName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

data NameRep Source #

The representation of a package name.

Constructors

ArchLinuxRep

archlinx community style

HackageRep

hackage style

isHaskellPackage :: ArchLinuxName -> Bool Source #

Judge if a package in archlinux community repo is haskell package.

i.e. it is in preset or have haskell- prefix, and is not present in falseList of NAME_PRESET.json.