packages feed

spdx 0.2.0.0 → 0.2.1.0

raw patch · 8 files changed

+118/−36 lines, 8 filesdep ~basedep ~transformersPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, transformers

API changes (from Hackage documentation)

- Data.SPDX: instance Eq Lic
- Data.SPDX: instance Ord Lic
- Data.SPDX: instance Read Lic
- Data.SPDX: instance Show Lic
- Data.SPDX.LatticeSyntax: instance Alternative (Eval v)
- Data.SPDX.LatticeSyntax: instance Applicative (Eval v)
- Data.SPDX.LatticeSyntax: instance Applicative LatticeSyntax
- Data.SPDX.LatticeSyntax: instance Data a => Data (LatticeSyntax a)
- Data.SPDX.LatticeSyntax: instance Eq a => Eq (LatticeSyntax a)
- Data.SPDX.LatticeSyntax: instance Foldable LatticeSyntax
- Data.SPDX.LatticeSyntax: instance Functor (Eval v)
- Data.SPDX.LatticeSyntax: instance Functor LatticeSyntax
- Data.SPDX.LatticeSyntax: instance Monad (Eval v)
- Data.SPDX.LatticeSyntax: instance Monad LatticeSyntax
- Data.SPDX.LatticeSyntax: instance MonadPlus (Eval v)
- Data.SPDX.LatticeSyntax: instance Ord a => Ord (LatticeSyntax a)
- Data.SPDX.LatticeSyntax: instance Read a => Read (LatticeSyntax a)
- Data.SPDX.LatticeSyntax: instance Show a => Show (LatticeSyntax a)
- Data.SPDX.LatticeSyntax: instance Traversable LatticeSyntax
- Data.SPDX.LatticeSyntax: instance Typeable LatticeSyntax
+ Data.SPDX: instance [safe] Eq Lic
+ Data.SPDX: instance [safe] Ord Lic
+ Data.SPDX: instance [safe] Read Lic
+ Data.SPDX: instance [safe] Show Lic
+ Data.SPDX.LatticeSyntax: instance [safe] Alternative (Eval v)
+ Data.SPDX.LatticeSyntax: instance [safe] Applicative (Eval v)
+ Data.SPDX.LatticeSyntax: instance [safe] Applicative LatticeSyntax
+ Data.SPDX.LatticeSyntax: instance [safe] Data a => Data (LatticeSyntax a)
+ Data.SPDX.LatticeSyntax: instance [safe] Eq a => Eq (LatticeSyntax a)
+ Data.SPDX.LatticeSyntax: instance [safe] Foldable LatticeSyntax
+ Data.SPDX.LatticeSyntax: instance [safe] Functor (Eval v)
+ Data.SPDX.LatticeSyntax: instance [safe] Functor LatticeSyntax
+ Data.SPDX.LatticeSyntax: instance [safe] Monad (Eval v)
+ Data.SPDX.LatticeSyntax: instance [safe] Monad LatticeSyntax
+ Data.SPDX.LatticeSyntax: instance [safe] MonadPlus (Eval v)
+ Data.SPDX.LatticeSyntax: instance [safe] Ord a => Ord (LatticeSyntax a)
+ Data.SPDX.LatticeSyntax: instance [safe] Read a => Read (LatticeSyntax a)
+ Data.SPDX.LatticeSyntax: instance [safe] Show a => Show (LatticeSyntax a)
+ Data.SPDX.LatticeSyntax: instance [safe] Traversable LatticeSyntax
+ Data.SPDX.LatticeSyntax: instance [safe] Typeable LatticeSyntax

Files

spdx.cabal view
@@ -1,5 +1,5 @@ name:                spdx-version:             0.2.0.0+version:             0.2.1.0 synopsis:            SPDX license expression language description:         Implementation of <http://spdx.org/sites/spdx/files/SPDX-2.0.pdf SPDX> related functionality. homepage:            https://github.com/phadej/spdx@@ -11,10 +11,15 @@ category:            Data build-type:          Simple extra-source-files:  README.md+tested-with:         GHC==7.4.2, GHC==7.6.3, GHC==7.8.4, GHC==7.10.2 cabal-version:       >=1.10 +source-repository head+  type: git+  location: https://github.com/phadej/spdx+ library-  default-language:    Haskell2010+  default-language:    Haskell98   exposed-modules:     Data.SPDX,                        Data.SPDX.LatticeSyntax   other-modules:       Data.SPDX.Licenses,@@ -24,26 +29,27 @@                        Data.SPDX.Ranges   other-extensions:    CPP                        DeriveFunctor,-                       GeneralizedNewtypeDeriving,                        DeriveFoldable,                        DeriveTraversable,-                       DeriveGeneric,                        DeriveDataTypeable+  if impl(ghc >=7.2)+    other-extensions:  DeriveGeneric   hs-source-dirs:      src/   ghc-options:         -Wall-  build-depends:       base              >=4.5 && <4.9,+  build-depends:       base              >=4.2 && <4.9,                        transformers      >=0.3 && <0.5-  if impl(ghc >= 7.4 && < 7.5)+  if impl(ghc >=7.2 && <7.5)     build-depends: ghc-prim + test-suite test   type:                exitcode-stdio-1.0   main-is:             Tests.hs   other-modules:       Generators-  default-language:    Haskell2010+  default-language:    Haskell98   hs-source-dirs:      tests   ghc-options:         -Wall   build-depends:       base              >=4.5  && <4.9,-                       tasty             >=0.10 && <0.11,+                       tasty             >=0.10 && <0.12,                        tasty-quickcheck  >=0.8  && <0.9,                        spdx
src/Data/SPDX.hs view
@@ -1,3 +1,7 @@+{-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif -- | -- Module      : Data.SPDX -- Description : SPDX licenses and expression language
src/Data/SPDX/LatticeSyntax.hs view
@@ -1,8 +1,15 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE DeriveDataTypeable #-}+#if __GLASGOW_HASKELL__ >= 701+#if __GLASGOW_HASKELL__ >= 703+{-# LANGUAGE Safe #-}+#else+{-# LANGUAGE Trustworthy #-}+#endif+#endif -- | -- Module      : Data.SPDX.LatticeSyntax -- Description : General lattice tools@@ -76,11 +83,29 @@ preorder a b = (a `LJoin` b) `equivalent` b  -- | Return `True` if for some variable assigment expression evaluates to `True`.-satisfiable :: Eq a => LatticeSyntax a -> Bool +satisfiable :: Eq a => LatticeSyntax a -> Bool satisfiable = or . runEval . evalLattice  newtype Eval v a = Eval { unEval :: StateT [(v, Bool)] [] a }-  deriving (Functor, Applicative, Alternative, Monad, MonadPlus)++instance Functor (Eval v) where+  fmap = liftM++instance Applicative (Eval v) where+  pure = return+  (<*>) = ap++instance Alternative (Eval v) where+  empty = mzero+  (<|>) = mplus++instance Monad (Eval v) where+  return = Eval . return+  Eval m >>= k = Eval $ m >>= unEval . k++instance MonadPlus (Eval v) where+  mzero = Eval mzero+  Eval a `mplus` Eval b = Eval $ a `mplus` b  runEval :: Eval v a -> [a] runEval act = evalStateT (unEval act) []
src/Data/SPDX/Licenses.hs view
@@ -1,3 +1,7 @@+{-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Data.SPDX.Licenses (     licenses   , licenseIdentifiers
src/Data/SPDX/Parser.hs view
@@ -1,4 +1,7 @@ {-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Data.SPDX.Parser (parseExpression, unsafeParseExpr) where  #ifndef MIN_VERSION_base@@ -6,23 +9,24 @@ #endif  import Control.Applicative+import Control.Monad import Data.Char import Text.ParserCombinators.ReadP  import Data.SPDX.Types import Data.SPDX.Licenses (licenseIdentifiers, licenseExceptions) -#if !MIN_VERSION_base(4,6,0)-import Control.Monad+infixl 4 `ap'` -instance Applicative ReadP where-  pure = return-  (<*>) = ap+-- ReadP isn't Applicative in old enough base+ap' :: Monad m => m (a -> b) -> m a -> m b+ap' = ap -instance Alternative ReadP where-  empty = mzero-  (<|>) = mplus-#endif+(<<) :: Monad m => m a -> m b -> m a+ma << mb = do+  a <- ma+  _ <- mb+  return a  license :: ReadP LicenseId license = choice (map f licenseIdentifiers)@@ -33,16 +37,16 @@   where f l = l <$ string (getLicenseExceptionId l)  licenseRef :: ReadP LicenseRef-licenseRef = l <|> d-  where l = LicenseRef Nothing <$ string "LicenseRef-" <*> idString-        d = (\docId licId -> LicenseRef (Just docId) licId) <$ string "DocumentRef-" <*> idString <* char ':' <* string "LicenseRef-" <*> idString+licenseRef = l `mplus` d+  where l = LicenseRef Nothing <$ string "LicenseRef-" `ap'` idString+        d = (\docId licId -> LicenseRef (Just docId) licId) <$ string "DocumentRef-" `ap'` idString << char ':' << string "LicenseRef-" `ap'` idString  mkLicense ::  ReadP (Either LicenseRef LicenseId) -> ReadP LicenseExpression mkLicense p = choice   [ (\l   -> ELicense False l Nothing)  <$> p-  , (\l e -> ELicense False l (Just e)) <$> p <* skipSpaces1 <* string "WITH" <* skipSpaces1 <*> licenseException-  , (\l   -> ELicense True  l Nothing)  <$> p <* char '+'-  , (\l e -> ELicense True  l (Just e)) <$> p <* char '+' <* string " WITH " <*> licenseException+  , (\l e -> ELicense False l (Just e)) <$> p << skipSpaces1 << string "WITH" << skipSpaces1 `ap'` licenseException+  , (\l   -> ELicense True  l Nothing)  <$> p << char '+'+  , (\l e -> ELicense True  l (Just e)) <$> p << char '+' << string " WITH " `ap'` licenseException   ]  elicense :: ReadP LicenseExpression@@ -58,10 +62,10 @@         p c   = isAlphaNum c  skipSpaces1 :: ReadP ()-skipSpaces1 = () <$ char ' ' <* skipSpaces+skipSpaces1 = () <$ char ' ' << skipSpaces  parens :: ReadP a -> ReadP a-parens = between (char '(') (skipSpaces <* char ')')+parens = between (char '(') (skipSpaces << char ')')  terminal :: ReadP LicenseExpression terminal = choice [ elicense@@ -70,20 +74,20 @@                   ]  conjunction :: ReadP LicenseExpression-conjunction = chainr1 terminal (EConjunction <$ skipSpaces1 <* string "AND" <* skipSpaces1)+conjunction = chainr1 terminal (EConjunction <$ skipSpaces1 << string "AND" << skipSpaces1)  disjunction :: ReadP LicenseExpression-disjunction = chainr1 conjunction (EDisjunction <$ skipSpaces1 <* string "OR" <* skipSpaces1)+disjunction = chainr1 conjunction (EDisjunction <$ skipSpaces1 << string "OR" << skipSpaces1)  expression :: ReadP LicenseExpression-expression = skipSpaces *> disjunction+expression = skipSpaces >> disjunction  -- | Parse SPDX License Expression -- -- >>> parseExpression "LGPL-2.1 OR MIT" -- [EDisjunction (ELicense False (Right (LicenseId "LGPL-2.1")) Nothing) (ELicense False (Right (LicenseId "MIT")) Nothing)] parseExpression :: String -> [LicenseExpression]-parseExpression = map fst . readP_to_S (expression <* skipSpaces <* eof)+parseExpression = map fst . readP_to_S (expression << skipSpaces << eof)  unsafeParseExpr :: String -> LicenseExpression unsafeParseExpr s = f . parseExpression $ s
src/Data/SPDX/Pretty.hs view
@@ -1,3 +1,7 @@+{-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif -- | Parser inverse. module Data.SPDX.Pretty   ( prettyLicenseId
src/Data/SPDX/Ranges.hs view
@@ -1,3 +1,7 @@+{-# LANGUAGE CPP #-}+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif module Data.SPDX.Ranges (licenseRanges, lookupLicenseRange) where  import Data.Char
src/Data/SPDX/Types.hs view
@@ -1,5 +1,17 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-}++#if __GLASGOW_HASKELL__ >= 701 {-# LANGUAGE DeriveGeneric #-}+#endif++#if __GLASGOW_HASKELL__ >= 701+#if __GLASGOW_HASKELL__ >= 703+{-# LANGUAGE Safe #-}+#else+{-# LANGUAGE Trustworthy #-}+#endif+#endif module Data.SPDX.Types (     LicenseId(..)   , getLicenseId@@ -10,24 +22,39 @@   ) where  import Data.Data++#if __GLASGOW_HASKELL__ >= 701 import GHC.Generics+#endif  data LicenseRef = LicenseRef   { lrDocument :: !(Maybe String)   , lrLicense  :: !String   }-  deriving (Eq, Ord, Show, Read, Typeable, Data, Generic)+  deriving (Eq, Ord, Show, Read, Typeable, Data+#if __GLASGOW_HASKELL__ >= 701+           , Generic+#endif+           )  -- | Opaque license identifier type. newtype LicenseId = LicenseId String-  deriving (Eq, Ord, Show, Read, Typeable, Data, Generic)+  deriving (Eq, Ord, Show, Read, Typeable, Data+#if __GLASGOW_HASKELL__ >= 701+           , Generic+#endif+           )  getLicenseId :: LicenseId -> String getLicenseId (LicenseId l) = l  -- | Opaque license exception identifier type. newtype LicenseExceptionId = LicenseExceptionId String-  deriving (Eq, Ord, Show, Read, Typeable, Data, Generic)+  deriving (Eq, Ord, Show, Read, Typeable, Data+#if __GLASGOW_HASKELL__ >= 701+           , Generic+#endif+           )  getLicenseExceptionId :: LicenseExceptionId -> String getLicenseExceptionId (LicenseExceptionId l) = l@@ -35,4 +62,8 @@ data LicenseExpression = ELicense !Bool !(Either LicenseRef LicenseId) !(Maybe LicenseExceptionId)                        | EConjunction !LicenseExpression !LicenseExpression                        | EDisjunction !LicenseExpression !LicenseExpression-  deriving (Eq, Ord, Show, Read, Typeable, Data, Generic)+  deriving (Eq, Ord, Show, Read, Typeable, Data+#if __GLASGOW_HASKELL__ >= 701+           , Generic+#endif+           )