Distribution.License

Cabal-3.0.1.0: A framework for packaging Haskell software

Copyright | Isaac Jones 2003-2005 Duncan Coutts 2008
License | BSD3
Maintainer | cabal-devel@haskell.org
Portability | portable
Safe Haskell | None
Language | Haskell2010

Distribution.License

Description

Package descriptions contain fields for specifying the name of a software license and the name of the file containing the text of that license. While package authors may choose any license they like, Cabal provides an enumeration of a small set of common free and open source software licenses. This is done so that Hackage can recognise licenses, so that tools can detect licensing conflicts, and to deter license proliferation.

It is recommended that all package authors use the `license-file` or `license-files` fields in their package descriptions. Further information about these fields can be found in the Cabal users guide.

# Additional resources

The following websites provide information about free and open source software licenses:

- The Open Source Initiative (OSI)
- The Free Software Foundation (FSF)

# Disclaimer

The descriptions of software licenses provided by this documentation are intended for informational purposes only and in no way constitute legal advice. Please read the text of the licenses and consult a lawyer for any advice regarding software licensing.

Synopsis

- data License
  - = GPL (Maybe Version)
  - | AGPL (Maybe Version)
  - | LGPL (Maybe Version)
  - | BSD2
  - | BSD3
  - | BSD4
  - | MIT
  - | ISC
  - | MPL Version
  - | Apache (Maybe Version)
  - | PublicDomain
  - | AllRightsReserved
  - | UnspecifiedLicense
  - | OtherLicense
  - | UnknownLicense String
- knownLicenses :: [License]
- licenseToSPDX :: License -> License
- licenseFromSPDX :: License -> License

# Documentation

data License Source #

Indicates the license under which a package's source code is released. Versions of the licenses not listed here will be rejected by Hackage and cause `cabal check` to issue a warning.

Constructors

GPL (Maybe Version) | GNU General Public License, version 2 or version 3.
AGPL (Maybe Version) | GNU Affero General Public License, version 3.
LGPL (Maybe Version) | GNU Lesser General Public License, version 2.1 or version 3.
BSD2 | 2-clause BSD license.
BSD3 | 3-clause BSD license.
BSD4 | 4-clause BSD license. This license has not been approved by the OSI and is incompatible with the GNU GPL. It is provided for historical reasons and should be avoided.
MIT | MIT license.
ISC | ISC license
MPL Version | Mozilla Public License, version 2.0.
Apache (Maybe Version) | Apache License, version 2.0.
PublicDomain | The author of a package disclaims any copyright to its source code and dedicates it to the public domain. This is not a software license. Please note that it is not possible to dedicate works to the public domain in every jurisdiction, nor is a work that is in the public domain in one jurisdiction necessarily in the public domain elsewhere.
AllRightsReserved | Explicitly 'All Rights Reserved', eg for proprietary software. The package may not be legally modified or redistributed by anyone but the rightsholder.
UnspecifiedLicense | No license specified which legally defaults to 'All Rights Reserved'. The package may not be legally modified or redistributed by anyone but the rightsholder.
OtherLicense | Any other software license.
UnknownLicense String | Indicates an erroneous license name.

#### Instances

Instances details

Eq License # |
Instance details Defined in Distribution.License Methods (==) :: License -> License -> Bool # (/=) :: License -> License -> Bool #
Data License # |
Instance details Defined in Distribution.License Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> License -> c License Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c License Source # toConstr :: License -> Constr Source # dataTypeOf :: License -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c License) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c License) Source # gmapT :: (forall b. Data b => b -> b) -> License -> License Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> License -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> License -> r Source # gmapQ :: (forall d. Data d => d -> u) -> License -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> License -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> License -> m License Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> License -> m License Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> License -> m License Source #
Read License # |
Instance details Defined in Distribution.License Methods readsPrec :: Int -> ReadS License Source # readList :: ReadS [License] Source # readPrec :: ReadPrec License Source # readListPrec :: ReadPrec [License] Source #
Show License # |
Instance details Defined in Distribution.License Methods showsPrec :: Int -> License -> ShowS Source # show :: License -> String Source # showList :: [License] -> ShowS Source #
Generic License # |
Instance details Defined in Distribution.License Associated Types type Rep License :: Type -> Type Source # Methods from :: License -> Rep License x Source # to :: Rep License x -> License Source #
Binary License # |
Instance details Defined in Distribution.License Methods put :: License -> Put Source # get :: Get License Source # putList :: [License] -> Put Source #
NFData License # |
Instance details Defined in Distribution.License Methods rnf :: License -> () Source #
Pretty License # |
Instance details Defined in Distribution.License Methods pretty :: License -> Doc Source # prettyVersioned :: CabalSpecVersion -> License -> Doc Source #
Parsec License # |
Instance details Defined in Distribution.License Methods parsec :: CabalParsing m => m License Source #
Newtype (Either License License) SpecLicense # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: Either License0 License -> SpecLicense Source # unpack :: SpecLicense -> Either License0 License Source #
type Rep License # |
Instance details Defined in Distribution.License type Rep License = D1 ('MetaData "License" "Distribution.License" "Cabal-3.0.1.0" 'False) (((C1 ('MetaCons "GPL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Version))) :+: (C1 ('MetaCons "AGPL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Version))) :+: C1 ('MetaCons "LGPL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Version))))) :+: ((C1 ('MetaCons "BSD2" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BSD3" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "BSD4" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MIT" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: (((C1 ('MetaCons "ISC" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MPL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version))) :+: (C1 ('MetaCons "Apache" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Version))) :+: C1 ('MetaCons "PublicDomain" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "AllRightsReserved" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "UnspecifiedLicense" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "OtherLicense" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "UnknownLicense" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))))

knownLicenses :: [License] Source #

The list of all currently recognised licenses.

licenseToSPDX :: License -> License Source #

Convert old `License` to SPDX `License`. Non-SPDX licenses are converted to `LicenseRef`.

Since: Cabal-2.2.0.0

licenseFromSPDX :: License -> License Source #

Convert `License` to `License`,

This is lossy conversion. We try our best.

    >>> licenseFromSPDX . licenseToSPDX $ BSD3
    BSD3

    >>> licenseFromSPDX . licenseToSPDX $ GPL (Just (mkVersion [3]))
    GPL (Just (mkVersion [3]))

    >>> licenseFromSPDX . licenseToSPDX $ PublicDomain
    UnknownLicense "LicenseRefPublicDomain"

    >>> licenseFromSPDX $ SPDX.License $ SPDX.simpleLicenseExpression SPDX.EUPL_1_1
    UnknownLicense "EUPL-1.1"

    >>> licenseFromSPDX . licenseToSPDX $ AllRightsReserved
    AllRightsReserved

    >>> licenseFromSPDX <$> simpleParsec "BSD-3-Clause OR GPL-3.0-only"
    Just (UnknownLicense "BSD3ClauseORGPL30only")

Since: Cabal-2.2.0.0