-- 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 -- | Inspired by Simple SMT Solver. -- -- 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. -- --
--   >>> equivalent (LMeet (LVar 'a') (LVar 'b')) (LMeet (LVar 'b') (LVar 'a'))
--   True
--   
-- --
--   >>> equivalent (LVar 'a') (LMeet (LVar 'a') (LVar 'a'))
--   True
--   
-- --
--   >>> equivalent (LMeet (LVar 'a') (LVar 'b')) (LMeet (LVar 'b') (LVar 'b'))
--   False
--   
equivalent :: Ord a => LatticeSyntax a -> LatticeSyntax a -> Bool -- | Test for preorder. -- --
--   a ≤ b ⇔ a ∨ b ≡ b ⇔ a ≡ a ∧ b
--   
-- --
--   >>> preorder (LVar 'a' `LMeet` LVar 'b') (LVar 'a')
--   True
--   
-- --
--   >>> preorder (LVar 'a') (LVar 'a' `LMeet` LVar 'b')
--   False
--   
preorder :: Ord a => LatticeSyntax a -> LatticeSyntax a -> Bool -- | Return True if for some variable assigment expression evaluates -- to True. 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 section 3.15 of SPDX Specification 2.1 -- -- Note: the NOASSERTION case is omitted. -- -- Old License can be migrated using following rules: -- -- data License -- | 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)
--   
data LicenseExpression -- | Simple License Expressions. data SimpleLicenseExpression -- | SPDX License identifier data LicenseId -- | SPDX License identifier data LicenseExceptionId -- |
--   ⟦ satisfies a b ⟧ ≡ a ≥ b ≡ a ∧ b = b
--   
-- --
--   >>> unsafeParseExpr "GPL-3.0-only" `satisfies` unsafeParseExpr "ISC AND MIT"
--   False
--   
-- --
--   >>> unsafeParseExpr "Zlib" `satisfies` unsafeParseExpr "ISC AND MIT AND Zlib"
--   True
--   
-- --
--   >>> unsafeParseExpr "(MIT OR GPL-2.0-only)" `satisfies` unsafeParseExpr "(ISC AND MIT)"
--   True
--   
-- --
--   >>> unsafeParseExpr "(MIT AND GPL-2.0-only)" `satisfies` unsafeParseExpr "(MIT AND GPL-2.0-only)"
--   True
--   
-- --
--   >>> unsafeParseExpr "(MIT AND GPL-2.0-only)" `satisfies` unsafeParseExpr "(ISC AND GPL-2.0-only)"
--   False
--   
satisfies :: License -> License -> Bool -- | Check wheather two LicenseExpression are equivalent. -- --
--   >>> unsafeParseExpr "(MIT AND GPL-2.0-only)" `equivalent` unsafeParseExpr "(GPL-2.0-only AND MIT)"
--   True
--   
-- --
--   >>> unsafeParseExpr "MIT" `equivalent` unsafeParseExpr "MIT OR BSD-3-Clause"
--   False
--   
equivalent :: License -> License -> Bool instance GHC.Classes.Ord Distribution.SPDX.Extra.Lic instance GHC.Classes.Eq Distribution.SPDX.Extra.Lic