Cabal-syntax-3.12.1.0: A library for working with .cabal files

Safe Haskell | None
Language | Haskell2010

Distribution.SPDX.LicenseExpression

Synopsis

- data LicenseExpression
  - = ELicense !SimpleLicenseExpression !(Maybe LicenseExceptionId)
  - | EAnd !LicenseExpression !LicenseExpression
  - | EOr !LicenseExpression !LicenseExpression
- data SimpleLicenseExpression
  - = ELicenseId LicenseId
  - | ELicenseIdPlus LicenseId
  - | ELicenseRef LicenseRef
- simpleLicenseExpression :: LicenseId -> LicenseExpression

# Documentation

data LicenseExpression Source #

SPDX License Expression.

    idstring              = 1*(ALPHA / DIGIT / "-" / "." )
    license id            = <short form license identifier inAppendix I.1>
    license exception id  = <short form license exception identifier inAppendix I.2>
    license ref           = ["DocumentRef-"1*(idstring)":"]"LicenseRef-"1*(idstring)

    simple expression     = license id / license id"+" / license ref

    compound expression   = 1*1(simple expression /
                            simple expression "WITH" license exception id /
                            compound expression "AND" compound expression /
                            compound expression "OR" compound expression ) /
                            "(" compound expression ")" )

    license expression    = 1*1(simple expression / compound expression)

Constructors

ELicense !SimpleLicenseExpression !(Maybe LicenseExceptionId) |
EAnd !LicenseExpression !LicenseExpression |
EOr !LicenseExpression !LicenseExpression |

#### Instances

Instances details

Parsec LicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods parsec :: CabalParsing m => m LicenseExpression Source #
Pretty LicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods pretty :: LicenseExpression -> Doc Source # prettyVersioned :: CabalSpecVersion -> LicenseExpression -> Doc Source #
Structured LicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods structure :: Proxy LicenseExpression -> Structure Source # structureHash' :: Tagged LicenseExpression MD5
Binary LicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods put :: LicenseExpression -> Put Source # get :: Get LicenseExpression Source # putList :: [LicenseExpression] -> Put Source #
NFData LicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods rnf :: LicenseExpression -> () Source #
Data LicenseExpression Source # |

Instance details

Defined in Distribution.SPDX.LicenseExpression

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LicenseExpression -> c LicenseExpression #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LicenseExpression #

toConstr :: LicenseExpression -> Constr #

dataTypeOf :: LicenseExpression -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LicenseExpression) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LicenseExpression) #

gmapT :: (forall b. Data b => b -> b) -> LicenseExpression -> LicenseExpression #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LicenseExpression -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LicenseExpression -> r #

gmapQ :: (forall d. Data d => d -> u) -> LicenseExpression -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> LicenseExpression -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> LicenseExpression -> m LicenseExpression #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LicenseExpression -> m LicenseExpression #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LicenseExpression -> m LicenseExpression #

Generic LicenseExpression Source # |

Instance details

Defined in Distribution.SPDX.LicenseExpression

Associated Types

type Rep LicenseExpression |

Instance details

Defined in Distribution.SPDX.LicenseExpression

type Rep LicenseExpression = D1 ('MetaData "LicenseExpression" "Distribution.SPDX.LicenseExpression" "Cabal-syntax-3.12.1.0-5c0e" 'False) (C1 ('MetaCons "ELicense" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SimpleLicenseExpression) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe LicenseExceptionId))) :+: (C1 ('MetaCons "EAnd" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LicenseExpression) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LicenseExpression)) :+: C1 ('MetaCons "EOr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LicenseExpression) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LicenseExpression))))

Methods

from :: LicenseExpression -> Rep LicenseExpression x #

to :: Rep LicenseExpression x -> LicenseExpression #

Read LicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods readsPrec :: Int -> ReadS LicenseExpression # readList :: ReadS [LicenseExpression] # readPrec :: ReadPrec LicenseExpression # readListPrec :: ReadPrec [LicenseExpression] #
Show LicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods showsPrec :: Int -> LicenseExpression -> ShowS # show :: LicenseExpression -> String # showList :: [LicenseExpression] -> ShowS #
Eq LicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods (==) :: LicenseExpression -> LicenseExpression -> Bool # (/=) :: LicenseExpression -> LicenseExpression -> Bool #
Ord LicenseExpression Source # |

Instance details

Defined in Distribution.SPDX.LicenseExpression

Methods

compare :: LicenseExpression -> LicenseExpression -> Ordering #

(<) :: LicenseExpression -> LicenseExpression -> Bool #

(<=) :: LicenseExpression -> LicenseExpression -> Bool #

(>) :: LicenseExpression -> LicenseExpression -> Bool #

(>=) :: LicenseExpression -> LicenseExpression -> Bool #

max :: LicenseExpression -> LicenseExpression -> LicenseExpression #

min :: LicenseExpression -> LicenseExpression -> LicenseExpression #

type Rep LicenseExpression Source # |

Instance details

Defined in Distribution.SPDX.LicenseExpression

type Rep LicenseExpression = D1 ('MetaData "LicenseExpression" "Distribution.SPDX.LicenseExpression" "Cabal-syntax-3.12.1.0-5c0e" 'False) (C1 ('MetaCons "ELicense" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SimpleLicenseExpression) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe LicenseExceptionId))) :+: (C1 ('MetaCons "EAnd" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LicenseExpression) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LicenseExpression)) :+: C1 ('MetaCons "EOr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LicenseExpression) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 LicenseExpression))))

data SimpleLicenseExpression Source #

Simple License Expressions.

Constructors

ELicenseId LicenseId | An SPDX License List Short Form Identifier. For example: `GPL-2.0-only`
ELicenseIdPlus LicenseId | An SPDX License List Short Form Identifier with a unary"+" operator suffix to represent the current version of the license or any later version. For example: `GPL-2.0+`
ELicenseRef LicenseRef | A SPDX user defined license reference: For example: `LicenseRef-23`, `LicenseRef-MIT-Style-1`, or `DocumentRef-spdx-tool-1.2:LicenseRef-MIT-Style-2`

#### Instances

Instances details

Parsec SimpleLicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods parsec :: CabalParsing m => m SimpleLicenseExpression Source #
Pretty SimpleLicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods pretty :: SimpleLicenseExpression -> Doc Source # prettyVersioned :: CabalSpecVersion -> SimpleLicenseExpression -> Doc Source #
Structured SimpleLicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods structure :: Proxy SimpleLicenseExpression -> Structure Source # structureHash' :: Tagged SimpleLicenseExpression MD5
Binary SimpleLicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods put :: SimpleLicenseExpression -> Put Source # get :: Get SimpleLicenseExpression Source # putList :: [SimpleLicenseExpression] -> Put Source #
NFData SimpleLicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods rnf :: SimpleLicenseExpression -> () Source #
Data SimpleLicenseExpression Source # |

Instance details

Defined in Distribution.SPDX.LicenseExpression

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SimpleLicenseExpression -> c SimpleLicenseExpression #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SimpleLicenseExpression #

toConstr :: SimpleLicenseExpression -> Constr #

dataTypeOf :: SimpleLicenseExpression -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SimpleLicenseExpression) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SimpleLicenseExpression) #

gmapT :: (forall b. Data b => b -> b) -> SimpleLicenseExpression -> SimpleLicenseExpression #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SimpleLicenseExpression -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SimpleLicenseExpression -> r #

gmapQ :: (forall d. Data d => d -> u) -> SimpleLicenseExpression -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SimpleLicenseExpression -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SimpleLicenseExpression -> m SimpleLicenseExpression #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SimpleLicenseExpression -> m SimpleLicenseExpression #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SimpleLicenseExpression -> m SimpleLicenseExpression #

Generic SimpleLicenseExpression Source # |

Instance details

Defined in Distribution.SPDX.LicenseExpression

Associated Types

type Rep SimpleLicenseExpression |

Instance details

Defined in Distribution.SPDX.LicenseExpression

type Rep SimpleLicenseExpression = D1 ('MetaData "SimpleLicenseExpression" "Distribution.SPDX.LicenseExpression" "Cabal-syntax-3.12.1.0-5c0e" 'False) (C1 ('MetaCons "ELicenseId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LicenseId)) :+: (C1 ('MetaCons "ELicenseIdPlus" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LicenseId)) :+: C1 ('MetaCons "ELicenseRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LicenseRef))))

Methods

from :: SimpleLicenseExpression -> Rep SimpleLicenseExpression x #

to :: Rep SimpleLicenseExpression x -> SimpleLicenseExpression #

Read SimpleLicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods readsPrec :: Int -> ReadS SimpleLicenseExpression # readList :: ReadS [SimpleLicenseExpression] # readPrec :: ReadPrec SimpleLicenseExpression # readListPrec :: ReadPrec [SimpleLicenseExpression] #
Show SimpleLicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods showsPrec :: Int -> SimpleLicenseExpression -> ShowS # show :: SimpleLicenseExpression -> String # showList :: [SimpleLicenseExpression] -> ShowS #
Eq SimpleLicenseExpression Source # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods (==) :: SimpleLicenseExpression -> SimpleLicenseExpression -> Bool # (/=) :: SimpleLicenseExpression -> SimpleLicenseExpression -> Bool #
Ord SimpleLicenseExpression Source # |

Instance details

Defined in Distribution.SPDX.LicenseExpression

Methods

compare :: SimpleLicenseExpression -> SimpleLicenseExpression -> Ordering #

(<) :: SimpleLicenseExpression -> SimpleLicenseExpression -> Bool #

(<=) :: SimpleLicenseExpression -> SimpleLicenseExpression -> Bool #

(>) :: SimpleLicenseExpression -> SimpleLicenseExpression -> Bool #

(>=) :: SimpleLicenseExpression -> SimpleLicenseExpression -> Bool #

max :: SimpleLicenseExpression -> SimpleLicenseExpression -> SimpleLicenseExpression #

min :: SimpleLicenseExpression -> SimpleLicenseExpression -> SimpleLicenseExpression #

type Rep SimpleLicenseExpression Source # |

Instance details

Defined in Distribution.SPDX.LicenseExpression

type Rep SimpleLicenseExpression = D1 ('MetaData "SimpleLicenseExpression" "Distribution.SPDX.LicenseExpression" "Cabal-syntax-3.12.1.0-5c0e" 'False) (C1 ('MetaCons "ELicenseId" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LicenseId)) :+: (C1 ('MetaCons "ELicenseIdPlus" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LicenseId)) :+: C1 ('MetaCons "ELicenseRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LicenseRef))))

simpleLicenseExpression :: LicenseId -> LicenseExpression Source #