-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | SPDX license expression language, Extras
--   
--   Cabal provides SPDX types. This package provides some extras.
@package spdx
@version 1.0.0.2


-- | Inspired by <a>Simple SMT Solver</a>.
--   
--   In future this module will probably be moved into separate package.
module Distribution.SPDX.Extra.Internal
data LatticeSyntax a
LVar :: a -> LatticeSyntax a
LBound :: Bool -> LatticeSyntax a
LJoin :: LatticeSyntax a -> LatticeSyntax a -> LatticeSyntax a
LMeet :: LatticeSyntax a -> LatticeSyntax a -> LatticeSyntax a
dual :: LatticeSyntax a -> LatticeSyntax a
freeVars :: LatticeSyntax a -> [a]

-- | Test for equivalence.
--   
--   <pre>
--   &gt;&gt;&gt; equivalent (LMeet (LVar 'a') (LVar 'b')) (LMeet (LVar 'b') (LVar 'a'))
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; equivalent (LVar 'a') (LMeet (LVar 'a') (LVar 'a'))
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; equivalent (LMeet (LVar 'a') (LVar 'b')) (LMeet (LVar 'b') (LVar 'b'))
--   False
--   </pre>
equivalent :: Ord a => LatticeSyntax a -> LatticeSyntax a -> Bool

-- | Test for preorder.
--   
--   <pre>
--   a ≤ b ⇔ a ∨ b ≡ b ⇔ a ≡ a ∧ b
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; preorder (LVar 'a' `LMeet` LVar 'b') (LVar 'a')
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; preorder (LVar 'a') (LVar 'a' `LMeet` LVar 'b')
--   False
--   </pre>
preorder :: Ord a => LatticeSyntax a -> LatticeSyntax a -> Bool

-- | Return <a>True</a> if for some variable assigment expression evaluates
--   to <a>True</a>.
satisfiable :: Ord a => LatticeSyntax a -> Bool
instance Data.Data.Data a => Data.Data.Data (Distribution.SPDX.Extra.Internal.LatticeSyntax a)
instance Data.Traversable.Traversable Distribution.SPDX.Extra.Internal.LatticeSyntax
instance Data.Foldable.Foldable Distribution.SPDX.Extra.Internal.LatticeSyntax
instance GHC.Base.Functor Distribution.SPDX.Extra.Internal.LatticeSyntax
instance GHC.Show.Show a => GHC.Show.Show (Distribution.SPDX.Extra.Internal.LatticeSyntax a)
instance GHC.Read.Read a => GHC.Read.Read (Distribution.SPDX.Extra.Internal.LatticeSyntax a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Distribution.SPDX.Extra.Internal.LatticeSyntax a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Distribution.SPDX.Extra.Internal.LatticeSyntax a)
instance GHC.Base.Functor (Distribution.SPDX.Extra.Internal.Eval v)
instance GHC.Base.Applicative (Distribution.SPDX.Extra.Internal.Eval v)
instance GHC.Base.Alternative (Distribution.SPDX.Extra.Internal.Eval v)
instance GHC.Base.Monad (Distribution.SPDX.Extra.Internal.Eval v)
instance GHC.Base.MonadPlus (Distribution.SPDX.Extra.Internal.Eval v)
instance GHC.Base.Applicative Distribution.SPDX.Extra.Internal.LatticeSyntax
instance GHC.Base.Monad Distribution.SPDX.Extra.Internal.LatticeSyntax


module Distribution.SPDX.Extra

-- | Declared license. See <a>section 3.15 of SPDX Specification 2.1</a>
--   
--   <i>Note:</i> the NOASSERTION case is omitted.
--   
--   Old <a>License</a> can be migrated using following rules:
--   
--   <ul>
--   <li><tt>AllRightsReserved</tt> and <tt>UnspecifiedLicense</tt> to
--   <a>NONE</a>. No license specified which legally defaults to <i>All
--   Rights Reserved</i>. The package may not be legally modified or
--   redistributed by anyone but the rightsholder.</li>
--   <li><tt>OtherLicense</tt> can be converted to <tt>LicenseRef</tt>
--   pointing to the file in the package.</li>
--   <li><tt>UnknownLicense</tt> i.e. other licenses of the form
--   <tt>name-x.y</tt>, should be covered by SPDX license list, otherwise
--   use <tt>LicenseRef</tt>.</li>
--   <li><tt>PublicDomain</tt> isn't covered. Consider using CC0. See
--   <a>https://wiki.spdx.org/view/Legal_Team/Decisions/Dealing_with_Public_Domain_within_SPDX_Files</a>
--   for more information.</li>
--   </ul>
data License

-- | SPDX License Expression.
--   
--   <pre>
--   idstring              = 1*(ALPHA / DIGIT / "-" / "." )
--   license id            = &lt;short form license identifier inAppendix I.1&gt;
--   license exception id  = &lt;short form license exception identifier inAppendix I.2&gt;
--   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)
--   </pre>
data LicenseExpression

-- | Simple License Expressions.
data SimpleLicenseExpression

-- | SPDX License identifier
data LicenseId

-- | SPDX License identifier
data LicenseExceptionId

-- | <pre>
--   ⟦ satisfies a b ⟧ ≡ a ≥ b ≡ a ∧ b = b
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeParseExpr "GPL-3.0-only" `satisfies` unsafeParseExpr "ISC AND MIT"
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeParseExpr "Zlib" `satisfies` unsafeParseExpr "ISC AND MIT AND Zlib"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeParseExpr "(MIT OR GPL-2.0-only)" `satisfies` unsafeParseExpr "(ISC AND MIT)"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeParseExpr "(MIT AND GPL-2.0-only)" `satisfies` unsafeParseExpr "(MIT AND GPL-2.0-only)"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeParseExpr "(MIT AND GPL-2.0-only)" `satisfies` unsafeParseExpr "(ISC AND GPL-2.0-only)"
--   False
--   </pre>
satisfies :: License -> License -> Bool

-- | Check wheather two <a>LicenseExpression</a> are equivalent.
--   
--   <pre>
--   &gt;&gt;&gt; unsafeParseExpr "(MIT AND GPL-2.0-only)" `equivalent` unsafeParseExpr "(GPL-2.0-only AND MIT)"
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsafeParseExpr "MIT" `equivalent` unsafeParseExpr "MIT OR BSD-3-Clause"
--   False
--   </pre>
equivalent :: License -> License -> Bool
instance GHC.Classes.Ord Distribution.SPDX.Extra.Lic
instance GHC.Classes.Eq Distribution.SPDX.Extra.Lic
