openSUSE Commits
Threads by month
- ----- 2024 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
January 2016
- 1 participants
- 1523 discussions
Hello community,
here is the log from the commit of package ghc-mono-traversable for openSUSE:Factory checked in at 2016-01-28 17:24:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-mono-traversable (Old)
and /work/SRC/openSUSE:Factory/.ghc-mono-traversable.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-mono-traversable"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-mono-traversable/ghc-mono-traversable.changes 2016-01-07 00:25:17.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-mono-traversable.new/ghc-mono-traversable.changes 2016-01-28 17:24:56.000000000 +0100
@@ -1,0 +2,6 @@
+Tue Jan 26 09:50:06 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 0.10.1
+* Allow comonad-5
+
+-------------------------------------------------------------------
Old:
----
mono-traversable-0.10.0.1.tar.gz
New:
----
mono-traversable-0.10.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-mono-traversable.spec ++++++
--- /var/tmp/diff_new_pack.QDsQN7/_old 2016-01-28 17:24:56.000000000 +0100
+++ /var/tmp/diff_new_pack.QDsQN7/_new 2016-01-28 17:24:56.000000000 +0100
@@ -20,7 +20,7 @@
%bcond_with tests
Name: ghc-mono-traversable
-Version: 0.10.0.1
+Version: 0.10.1
Release: 0
Summary: Type classes for mapping, folding, and traversing monomorphic containers
Group: System/Libraries
++++++ mono-traversable-0.10.0.1.tar.gz -> mono-traversable-0.10.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mono-traversable-0.10.0.1/ChangeLog.md new/mono-traversable-0.10.1/ChangeLog.md
--- old/mono-traversable-0.10.0.1/ChangeLog.md 2015-12-13 09:10:48.000000000 +0100
+++ new/mono-traversable-0.10.1/ChangeLog.md 2016-01-18 13:20:42.000000000 +0100
@@ -1,3 +1,7 @@
+## 0.10.1
+
+* Allow comonad-5 [#86](https://github.com/snoyberg/mono-traversable/issues/86)
+
## 0.10.0.1
* Instance for Data.Sequence.Seq is incorrect. [#83](https://github.com/snoyberg/mono-traversable/issues/83)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mono-traversable-0.10.0.1/mono-traversable.cabal new/mono-traversable-0.10.1/mono-traversable.cabal
--- old/mono-traversable-0.10.0.1/mono-traversable.cabal 2015-12-13 09:10:48.000000000 +0100
+++ new/mono-traversable-0.10.1/mono-traversable.cabal 2016-01-18 13:20:42.000000000 +0100
@@ -1,5 +1,5 @@
name: mono-traversable
-version: 0.10.0.1
+version: 0.10.1
synopsis: Type classes for mapping, folding, and traversing monomorphic containers
description: Monomorphic variants of the Functor, Foldable, and Traversable typeclasses. If you understand Haskell's basic typeclasses, you understand mono-traversable. In addition to what you are used to, it adds on an IsSequence typeclass and has code for marking data structures as non-empty.
homepage: https://github.com/snoyberg/mono-traversable
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/mono-traversable-0.10.0.1/src/Data/MonoTraversable.hs new/mono-traversable-0.10.1/src/Data/MonoTraversable.hs
--- old/mono-traversable-0.10.0.1/src/Data/MonoTraversable.hs 2015-12-13 09:10:48.000000000 +0100
+++ new/mono-traversable-0.10.1/src/Data/MonoTraversable.hs 2016-01-18 13:20:42.000000000 +0100
@@ -1,4 +1,5 @@
{-# LANGUAGE ConstrainedClassMethods #-}
+{-# LANGUAGE CPP #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
@@ -68,7 +69,9 @@
import Control.Comonad.Store (StoreT)
import Control.Comonad.Env (EnvT)
import Control.Comonad.Traced (TracedT)
+#if !MIN_VERSION_comonad(5,0,0)
import Data.Functor.Coproduct (Coproduct)
+#endif
import Control.Monad.Trans.Writer (WriterT)
import qualified Control.Monad.Trans.Writer.Strict as Strict (WriterT)
import Control.Monad.Trans.State (StateT(..))
@@ -151,7 +154,9 @@
type instance Element (EnvT e w a) = a
type instance Element (StoreT s w a) = a
type instance Element (TracedT m w a) = a
+#if !MIN_VERSION_comonad(5,0,0)
type instance Element (Coproduct f g a) = a
+#endif
-- | Monomorphic containers that can be mapped over.
class MonoFunctor mono where
@@ -198,7 +203,9 @@
instance Functor w => MonoFunctor (EnvT e w a)
instance Functor w => MonoFunctor (StoreT s w a)
instance Functor w => MonoFunctor (TracedT m w a)
+#if !MIN_VERSION_comonad(5,0,0)
instance (Functor f, Functor g) => MonoFunctor (Coproduct f g a)
+#endif
instance Arrow a => MonoFunctor (WrappedArrow a b c)
instance Functor f => MonoFunctor (MaybeApply f a)
instance Functor f => MonoFunctor (WrappedApplicative f a)
@@ -1274,7 +1281,9 @@
instance Comonad w => MonoComonad (EnvT e w a)
instance Comonad w => MonoComonad (StoreT s w a)
instance (Comonad w, Monoid m) => MonoComonad (TracedT m w a)
+#if !MIN_VERSION_comonad(5,0,0)
instance (Comonad f, Comonad g) => MonoComonad (Coproduct f g a)
+#endif
-- Not Comonad
instance MonoComonad (ViewL a) where
1
0
Hello community,
here is the log from the commit of package ghc-memory for openSUSE:Factory checked in at 2016-01-28 17:23:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-memory (Old)
and /work/SRC/openSUSE:Factory/.ghc-memory.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-memory"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-memory/ghc-memory.changes 2016-01-07 00:25:18.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-memory.new/ghc-memory.changes 2016-01-28 17:24:53.000000000 +0100
@@ -1,0 +2,5 @@
+Fri Jan 15 10:04:57 UTC 2016 - mimi.vx(a)gmail.com
+
+- update 0.11
+
+-------------------------------------------------------------------
Old:
----
memory-0.10.tar.gz
New:
----
memory-0.11.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-memory.spec ++++++
--- /var/tmp/diff_new_pack.UOWviT/_old 2016-01-28 17:24:54.000000000 +0100
+++ /var/tmp/diff_new_pack.UOWviT/_new 2016-01-28 17:24:54.000000000 +0100
@@ -21,7 +21,7 @@
%bcond_with tests
Name: ghc-memory
-Version: 0.10
+Version: 0.11
Release: 0
Summary: Memory and related abtraction stuff
License: BSD-3-Clause
++++++ memory-0.10.tar.gz -> memory-0.11.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/memory-0.10/Data/ByteArray/ScrubbedBytes.hs new/memory-0.11/Data/ByteArray/ScrubbedBytes.hs
--- old/memory-0.10/Data/ByteArray/ScrubbedBytes.hs 2015-09-08 15:28:21.000000000 +0200
+++ new/memory-0.11/Data/ByteArray/ScrubbedBytes.hs 2016-01-12 23:28:28.000000000 +0100
@@ -64,10 +64,29 @@
| otherwise = IO $ \s ->
case newAlignedPinnedByteArray# sz 8# s of
(# s1, mbarr #) ->
- let !scrubber = getScrubber sz
+ let !scrubber = (getScrubber sz) (byteArrayContents# (unsafeCoerce# mbarr))
!mba = ScrubbedBytes mbarr
- in case mkWeak# mbarr () (scrubber (byteArrayContents# (unsafeCoerce# mbarr)) >> touchScrubbedBytes mba) s1 of
+ in case mkWeak# mbarr () (finalize scrubber mba) s1 of
(# s2, _ #) -> (# s2, mba #)
+ where
+#if __GLASGOW_HASKELL__ > 800
+ finalize :: (State# RealWorld -> State# RealWorld) -> ScrubbedBytes -> State# RealWorld -> State# RealWorld
+ finalize scrubber mba@(ScrubbedBytes _) = \s1 ->
+ case scrubber s1 of
+ s2 -> touch# mba s2
+#elif __GLASGOW_HASKELL__ >= 800
+ finalize :: (State# RealWorld -> State# RealWorld) -> ScrubbedBytes -> State# RealWorld -> (# State# RealWorld, () #)
+ finalize scrubber mba@(ScrubbedBytes _) = \s1 ->
+ case scrubber s1 of
+ s2 -> case touch# mba s2 of
+ s3 -> (# s3, () #)
+#else
+ finalize :: (State# RealWorld -> State# RealWorld) -> ScrubbedBytes -> IO ()
+ finalize scrubber mba@(ScrubbedBytes _) = IO $ \s1 -> do
+ case scrubber s1 of
+ s2 -> case touch# mba s2 of
+ s3 -> (# s3, () #)
+#endif
scrubbedBytesAllocRet :: Int -> (Ptr p -> IO a) -> IO (a, ScrubbedBytes)
scrubbedBytesAllocRet sz f = do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/memory-0.10/Data/Memory/Internal/CompatPrim.hs new/memory-0.11/Data/Memory/Internal/CompatPrim.hs
--- old/memory-0.10/Data/Memory/Internal/CompatPrim.hs 2015-09-08 15:28:21.000000000 +0200
+++ new/memory-0.11/Data/Memory/Internal/CompatPrim.hs 2016-01-12 23:28:28.000000000 +0100
@@ -75,10 +75,10 @@
-> (Int# -> a) -- ^ if it divided by 8, the argument is the number of 8 bytes words
-> (Int# -> a) -- ^ if it doesn't, just the number of bytes
-> a
-#if __GLASGOW_HASKELL__ >= 740
+#if __GLASGOW_HASKELL__ > 704
eitherDivideBy8# v f8 f1 =
- let !(# q, r #) = quotRemInt v 8#
- in if booleanPrim (r ==# 0)
+ let !(# q, r #) = quotRemInt# v 8#
+ in if booleanPrim (r ==# 0#)
then f8 q
else f1 v
#else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/memory-0.10/Data/Memory/Internal/Scrubber.hs new/memory-0.11/Data/Memory/Internal/Scrubber.hs
--- old/memory-0.10/Data/Memory/Internal/Scrubber.hs 2015-09-08 15:28:21.000000000 +0200
+++ new/memory-0.11/Data/Memory/Internal/Scrubber.hs 2016-01-12 23:28:28.000000000 +0100
@@ -15,10 +15,9 @@
) where
import GHC.Prim
-import GHC.IO
import Data.Memory.Internal.CompatPrim (booleanPrim)
-getScrubber :: Int# -> (Addr# -> IO ())
+getScrubber :: Int# -> (Addr# -> State# RealWorld -> State# RealWorld)
getScrubber sz
| booleanPrim (sz ==# 4#) = scrub4
| booleanPrim (sz ==# 8#) = scrub8
@@ -26,31 +25,31 @@
| booleanPrim (sz ==# 32#) = scrub32
| otherwise = scrubBytes sz
where
- scrub4 a = IO $ \s -> (# writeWord32OffAddr# a 0# 0## s, () #)
+ scrub4 a = \s -> writeWord32OffAddr# a 0# 0## s
#if WORD_SIZE_IN_BITS == 64
- scrub8 a = IO $ \s -> (# writeWord64OffAddr# a 0# 0## s, () #)
- scrub16 a = IO $ \s1 ->
+ scrub8 a = \s -> writeWord64OffAddr# a 0# 0## s
+ scrub16 a = \s1 ->
let !s2 = writeWord64OffAddr# a 0# 0## s1
!s3 = writeWord64OffAddr# a 1# 0## s2
- in (# s3, () #)
- scrub32 a = IO $ \s1 ->
+ in s3
+ scrub32 a = \s1 ->
let !s2 = writeWord64OffAddr# a 0# 0## s1
!s3 = writeWord64OffAddr# a 1# 0## s2
!s4 = writeWord64OffAddr# a 2# 0## s3
!s5 = writeWord64OffAddr# a 3# 0## s4
- in (# s5, () #)
+ in s5
#else
- scrub8 a = IO $ \s1 ->
+ scrub8 a = \s1 ->
let !s2 = writeWord32OffAddr# a 0# 0## s1
!s3 = writeWord32OffAddr# a 1# 0## s2
- in (# s3, () #)
- scrub16 a = IO $ \s1 ->
+ in s3
+ scrub16 a = \s1 ->
let !s2 = writeWord32OffAddr# a 0# 0## s1
!s3 = writeWord32OffAddr# a 1# 0## s2
!s4 = writeWord32OffAddr# a 2# 0## s3
!s5 = writeWord32OffAddr# a 3# 0## s4
- in (# s5, () #)
- scrub32 a = IO $ \s1 ->
+ in s5
+ scrub32 a = \s1 ->
let !s2 = writeWord32OffAddr# a 0# 0## s1
!s3 = writeWord32OffAddr# a 1# 0## s2
!s4 = writeWord32OffAddr# a 2# 0## s3
@@ -59,11 +58,11 @@
!s7 = writeWord32OffAddr# a 5# 0## s6
!s8 = writeWord32OffAddr# a 6# 0## s7
!s9 = writeWord32OffAddr# a 7# 0## s8
- in (# s9, () #)
+ in s9
#endif
-scrubBytes :: Int# -> Addr# -> IO ()
-scrubBytes sz8 addr = IO $ \s -> (# loop sz8 addr s, () #)
+scrubBytes :: Int# -> Addr# -> State# RealWorld -> State# RealWorld
+scrubBytes sz8 addr = \s -> loop sz8 addr s
where loop :: Int# -> Addr# -> State# RealWorld -> State# RealWorld
loop n a s
| booleanPrim (n ==# 0#) = s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/memory-0.10/memory.cabal new/memory-0.11/memory.cabal
--- old/memory-0.10/memory.cabal 2015-09-08 15:28:21.000000000 +0200
+++ new/memory-0.11/memory.cabal 2016-01-12 23:28:28.000000000 +0100
@@ -1,5 +1,5 @@
Name: memory
-Version: 0.10
+Version: 0.11
Synopsis: memory and related abstraction stuff
Description:
Chunk of memory, polymorphic byte array management and manipulation
@@ -13,6 +13,8 @@
* Aliasing with endianness support.
.
* Encoding : Base16, Base32, Base64.
+ .
+ * Hashing : FNV, SipHash
License: BSD3
License-file: LICENSE
Copyright: Vincent Hanquez <vincent(a)snarc.org>
1
0
Hello community,
here is the log from the commit of package ghc-lifted-async for openSUSE:Factory checked in at 2016-01-28 17:23:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-lifted-async (Old)
and /work/SRC/openSUSE:Factory/.ghc-lifted-async.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-lifted-async"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-lifted-async/ghc-lifted-async.changes 2015-12-01 09:19:32.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-lifted-async.new/ghc-lifted-async.changes 2016-01-28 17:24:49.000000000 +0100
@@ -1,0 +2,10 @@
+Wed Jan 20 09:54:36 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 0.8.0.1
+* Relax upper bound for constraints
+* Drop Monad instance for Concurrently
+* Expose STM operations
+* Relax upper bound for base
+* Add Monoid and Semigroup instances for Concurrently
+
+-------------------------------------------------------------------
Old:
----
lifted-async-0.7.0.2.tar.gz
New:
----
lifted-async-0.8.0.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-lifted-async.spec ++++++
--- /var/tmp/diff_new_pack.VCDfbf/_old 2016-01-28 17:24:53.000000000 +0100
+++ /var/tmp/diff_new_pack.VCDfbf/_new 2016-01-28 17:24:53.000000000 +0100
@@ -21,7 +21,7 @@
%bcond_with tests
Name: ghc-lifted-async
-Version: 0.7.0.2
+Version: 0.8.0.1
Release: 0
Summary: Run lifted IO operations asynchronously and wait for their results
License: BSD-3-Clause
++++++ lifted-async-0.7.0.2.tar.gz -> lifted-async-0.8.0.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-async-0.7.0.2/CHANGELOG.md new/lifted-async-0.8.0.1/CHANGELOG.md
--- old/lifted-async-0.7.0.2/CHANGELOG.md 2015-11-27 02:28:01.000000000 +0100
+++ new/lifted-async-0.8.0.1/CHANGELOG.md 2016-01-17 22:16:51.000000000 +0100
@@ -1,3 +1,14 @@
+## v0.8.0.1 - 2015-01-17
+
+* Relax upper bound for constraints
+
+## v0.8.0 - 2016-01-10
+
+* Drop Monad instance for Concurrently
+* Expose STM operations
+* Relax upper bound for base and async
+* Add Monoid and Semigroup instances for Concurrently
+
## v0.7.0.2 - 2015-11-26
* Relax upper bound for the constraints package
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-async-0.7.0.2/lifted-async.cabal new/lifted-async-0.8.0.1/lifted-async.cabal
--- old/lifted-async-0.7.0.2/lifted-async.cabal 2015-11-27 02:28:01.000000000 +0100
+++ new/lifted-async-0.8.0.1/lifted-async.cabal 2016-01-17 22:16:51.000000000 +0100
@@ -1,5 +1,5 @@
name: lifted-async
-version: 0.7.0.2
+version: 0.8.0.1
synopsis: Run lifted IO operations asynchronously and wait for their results
homepage: https://github.com/maoe/lifted-async
bug-reports: https://github.com/maoe/lifted-async/issues
@@ -7,7 +7,7 @@
license-file: LICENSE
author: Mitsutoshi Aoe
maintainer: Mitsutoshi Aoe <maoe(a)foldr.in>
-copyright: Copyright (C) 2012-2015 Mitsutoshi Aoe
+copyright: Copyright (C) 2012-2016 Mitsutoshi Aoe
category: Concurrency
build-type: Simple
cabal-version: >= 1.8
@@ -34,14 +34,14 @@
Control.Concurrent.Async.Lifted
Control.Concurrent.Async.Lifted.Safe
build-depends:
- base >= 4.5 && < 4.9
- , async >= 2.0.1 && < 2.1
+ base >= 4.5 && < 4.10
+ , async >= 2.0.1 && < 2.2
, lifted-base >= 0.2 && < 0.3
, transformers-base >= 0.4 && < 0.5
if flag(monad-control-1)
build-depends: monad-control == 1.0.*
if impl(ghc >= 7.8)
- build-depends: constraints >= 0.2 && < 0.7
+ build-depends: constraints >= 0.2 && < 0.9
else
build-depends: constraints >= 0.2 && < 0.6
else
@@ -114,5 +114,5 @@
source-repository this
type: git
- tag: v0.7.0.2
+ tag: v0.8.0.1
location: https://github.com/maoe/lifted-async.git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-async-0.7.0.2/src/Control/Concurrent/Async/Lifted/Safe.hs new/lifted-async-0.8.0.1/src/Control/Concurrent/Async/Lifted/Safe.hs
--- old/lifted-async-0.7.0.2/src/Control/Concurrent/Async/Lifted/Safe.hs 2015-11-27 02:28:01.000000000 +0100
+++ new/lifted-async-0.8.0.1/src/Control/Concurrent/Async/Lifted/Safe.hs 2016-01-17 22:16:51.000000000 +0100
@@ -53,6 +53,16 @@
, Unsafe.waitEither_
, waitBoth
+#if MIN_VERSION_async(2, 1, 0)
+ -- ** Waiting for multiple 'Async's in STM
+ , A.waitAnySTM
+ , A.waitAnyCatchSTM
+ , A.waitEitherSTM
+ , A.waitEitherCatchSTM
+ , A.waitEitherSTM_
+ , A.waitBothSTM
+#endif
+
-- ** Linking
, Unsafe.link, Unsafe.link2
@@ -89,6 +99,11 @@
#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 710
import Data.Traversable
#endif
+#if !MIN_VERSION_base(4, 8, 0)
+import Data.Monoid (Monoid(mappend, mempty))
+#elif MIN_VERSION_base(4, 9, 0)
+import Data.Semigroup (Semigroup((<>)))
+#endif
-- | Generalized version of 'A.async'.
async
@@ -366,8 +381,20 @@
\\ (inst :: Forall (Pure m) :- Pure m a)
\\ (inst :: Forall (Pure m) :- Pure m b)
-instance (MonadBaseControl IO m, Forall (Pure m)) =>
- Monad (Concurrently m) where
- return = Concurrently . return
- Concurrently a >>= f = Concurrently $ a >>= runConcurrently . f
+#if MIN_VERSION_base(4, 9, 0)
+instance (MonadBaseControl IO m, Semigroup a, Forall (Pure m)) =>
+ Semigroup (Concurrently m a) where
+ (<>) = liftA2 (<>)
+
+instance (MonadBaseControl IO m, Semigroup a, Monoid a, Forall (Pure m)) =>
+ Monoid (Concurrently m a) where
+ mempty = pure mempty
+ mappend = (<>)
+#else
+instance (MonadBaseControl IO m, Monoid a, Forall (Pure m)) =>
+ Monoid (Concurrently m a) where
+ mempty = pure mempty
+ mappend = liftA2 mappend
+#endif
+
#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-async-0.7.0.2/src/Control/Concurrent/Async/Lifted.hs new/lifted-async-0.8.0.1/src/Control/Concurrent/Async/Lifted.hs
--- old/lifted-async-0.7.0.2/src/Control/Concurrent/Async/Lifted.hs 2015-11-27 02:28:01.000000000 +0100
+++ new/lifted-async-0.8.0.1/src/Control/Concurrent/Async/Lifted.hs 2016-01-17 22:16:51.000000000 +0100
@@ -49,11 +49,21 @@
, waitEither_
, waitBoth
+#if MIN_VERSION_async(2, 1, 0)
+ -- ** Waiting for multiple 'Async's in STM
+ , A.waitAnySTM
+ , A.waitAnyCatchSTM
+ , A.waitEitherSTM
+ , A.waitEitherCatchSTM
+ , A.waitEitherSTM_
+ , A.waitBothSTM
+#endif
+
-- ** Linking
, link, link2
-- * Convenient utilities
- , race, race_, concurrently, mapConcurrently
+ , race, race_, concurrently, mapConcurrently, forConcurrently
, Concurrently(..)
) where
@@ -73,6 +83,11 @@
#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 710
import Data.Traversable
#endif
+#if !MIN_VERSION_base(4, 8, 0)
+import Data.Monoid (Monoid(mappend, mempty))
+#elif MIN_VERSION_base(4, 9, 0)
+import Data.Semigroup (Semigroup((<>)))
+#endif
-- | Generalized version of 'A.async'.
async :: MonadBaseControl IO m => m a -> m (Async (StM m a))
@@ -352,6 +367,14 @@
-> m (t b)
mapConcurrently f = runConcurrently . traverse (Concurrently . f)
+-- | Generalized version of 'A.forConcurrently'.
+forConcurrently
+ :: (Traversable t, MonadBaseControl IO m)
+ => t a
+ -> (a -> m b)
+ -> m (t b)
+forConcurrently = flip mapConcurrently
+
-- | Generalized version of 'A.Concurrently'.
--
-- A value of type @'Concurrently' m a@ is an IO-based operation that can be
@@ -385,9 +408,20 @@
Concurrently as <|> Concurrently bs =
Concurrently $ either id id <$> race as bs
-instance MonadBaseControl IO m => Monad (Concurrently m) where
- return = Concurrently . return
- Concurrently a >>= f = Concurrently $ a >>= runConcurrently . f
+#if MIN_VERSION_base(4, 9, 0)
+instance (MonadBaseControl IO m, Semigroup a) =>
+ Semigroup (Concurrently m a) where
+ (<>) = liftA2 (<>)
+
+instance (MonadBaseControl IO m, Semigroup a, Monoid a) =>
+ Monoid (Concurrently m a) where
+ mempty = pure mempty
+ mappend = (<>)
+#else
+instance (MonadBaseControl IO m, Monoid a) => Monoid (Concurrently m a) where
+ mempty = pure mempty
+ mappend = liftA2 mappend
+#endif
sequenceEither :: MonadBaseControl IO m => Either e (StM m a) -> m (Either e a)
sequenceEither = either (return . Left) (liftM Right . restoreM)
1
0
Hello community,
here is the log from the commit of package ghc-JuicyPixels for openSUSE:Factory checked in at 2016-01-28 17:23:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-JuicyPixels (Old)
and /work/SRC/openSUSE:Factory/.ghc-JuicyPixels.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-JuicyPixels"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-JuicyPixels/ghc-JuicyPixels.changes 2015-12-09 22:16:50.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-JuicyPixels.new/ghc-JuicyPixels.changes 2016-01-28 17:24:47.000000000 +0100
@@ -1,0 +2,11 @@
+Tue Jan 26 09:39:22 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 3.2.7
+* Addition: convertRGB8 and convertRGBA8 helper functions
+* Addition: new output colorspace for JPEG format: Y, RGB & CMYK
+* Addition: RGBA8 bitmap reading (thanks to mtolly)
+* Enhancement: Optimized JPG & Tiff reading (thanks to Calvin Beck)
+* Enhancement: INLINE SPECIALIZE for pixelMap (Pixel8 -> Pixel8) (thx to Calvin Beck)
+* Fix: GHC 8.0 compilation (thanks to phadej)
+
+-------------------------------------------------------------------
Old:
----
JuicyPixels-3.2.6.4.tar.gz
New:
----
JuicyPixels-3.2.7.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-JuicyPixels.spec ++++++
--- /var/tmp/diff_new_pack.bDE1ez/_old 2016-01-28 17:24:49.000000000 +0100
+++ /var/tmp/diff_new_pack.bDE1ez/_new 2016-01-28 17:24:49.000000000 +0100
@@ -20,7 +20,7 @@
# no useful debuginfo for Haskell packages without C sources
%global debug_package %{nil}
Name: ghc-JuicyPixels
-Version: 3.2.6.4
+Version: 3.2.7
Release: 0
Summary: Picture loading/serialization
License: BSD-3-Clause
++++++ JuicyPixels-3.2.6.4.tar.gz -> JuicyPixels-3.2.7.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/JuicyPixels.cabal new/JuicyPixels-3.2.7/JuicyPixels.cabal
--- old/JuicyPixels-3.2.6.4/JuicyPixels.cabal 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/JuicyPixels.cabal 2016-01-25 23:33:57.000000000 +0100
@@ -1,5 +1,5 @@
Name: JuicyPixels
-Version: 3.2.6.4
+Version: 3.2.7
Synopsis: Picture loading/serialization (in png, jpeg, bitmap, gif, tga, tiff and radiance)
Description:
<<data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADABAMAAACg8nE0AAAAElBMVEUAAABJqDSTWEL/qyb///8AAABH/1GTAAAAAXRSTlMAQObYZgAAAN5JREFUeF7s1sEJgFAQxFBbsAV72v5bEVYWPwT/XDxmCsi7zvHXavYREBDI3XP2GgICqBBYuwIC+/rVayPUAyAg0HvIXBcQoDFDGnUBgWQQ2Bx3AYFaRoBpAQHWb3bt2ARgGAiCYFFuwf3X5HA/McgGJWI2FdykCv4aBYzmKwDwvl6NVmUAAK2vlwEALK7fo88GANB6HQsAAAAAAAAA7P94AQCzswEAAAAAAAAAAAAAAAAAAICzh4UAO4zWAYBfRutHA4Bn5C69JhowAMGoBaMWDG0wCkbBKBgFo2AUAACPmegUST/IJAAAAABJRU5ErkJggg==>>
@@ -28,7 +28,7 @@
Source-Repository this
Type: git
Location: git://github.com/Twinside/Juicy.Pixels.git
- Tag: v3.2.6.4
+ Tag: v3.2.7
Flag Mmap
Description: Enable the file loading via mmap (memory map)
@@ -52,11 +52,10 @@
Codec.Picture.ColorQuant
Ghc-options: -O3 -Wall
- Ghc-prof-options: -rtsopts -Wall -prof -auto-all
Build-depends: base >= 4.5 && < 5,
bytestring >= 0.9 && < 0.11,
mtl >= 1.1 && < 2.3,
- binary >= 0.5 && < 0.8,
+ binary >= 0.5 && < 0.9,
zlib >= 0.5.3.1 && < 0.7,
transformers >= 0.2,
vector >= 0.9 && < 0.12,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/README.md new/JuicyPixels-3.2.7/README.md
--- old/JuicyPixels-3.2.6.4/README.md 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/README.md 2016-01-25 23:33:57.000000000 +0100
@@ -52,6 +52,7 @@
- Bitmap (.bmp) (mainly used as a debug output format)
* Reading
+ - 32bits (RGBA) images
- 24bits (RGB) images
- 8bits (greyscale & paletted) images
@@ -62,10 +63,12 @@
* Metadata (reading/writing): DPI information
- - Jpeg (.jpg, .jpeg)
+ - Jpeg (.jpg, .jpeg)
* Reading normal and interlaced baseline DCT image
- YCbCr (default) CMYK/YCbCrK/RGB colorspaces
+
* Writing non-interlaced JPG
+ - YCbCr (favored), Y, RGB & CMYK colorspaces
* Metadata:
- Reading and writing DpiX & DpiY from JFIF header.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/changelog new/JuicyPixels-3.2.7/changelog
--- old/JuicyPixels-3.2.6.4/changelog 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/changelog 2016-01-25 23:33:57.000000000 +0100
@@ -1,7 +1,20 @@
Change log
==========
-v3.2.6.3 December 2015
+v3.2.7 January 2016
+-------------------
+ * Addition: convertRGB8 and convertRGBA8 helper functions
+ * Addition: new output colorspace for JPEG format: Y, RGB & CMYK
+ * Addition: RGBA8 bitmap reading (thanks to mtolly)
+ * Enhancement: Optimized JPG & Tiff reading (thanks to Calvin Beck)
+ * Enhancement: INLINE SPECIALIZE for pixelMap (Pixel8 -> Pixel8) (thx to Calvin Beck)
+ * Fix: GHC 8.0 compilation (thanks to phadej)
+
+v3.2.6.5 December 2015
+----------------------
+ * Fix: Compilation on GHC 7.6/7.8
+
+v3.2.6.4 December 2015
----------------------
* Fix: previous broken bugfix.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/src/Codec/Picture/BitWriter.hs new/JuicyPixels-3.2.7/src/Codec/Picture/BitWriter.hs
--- old/JuicyPixels-3.2.6.4/src/Codec/Picture/BitWriter.hs 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/src/Codec/Picture/BitWriter.hs 2016-01-25 23:33:57.000000000 +0100
@@ -1,4 +1,5 @@
{-# LANGUAGE Rank2Types #-}
+{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
-- | This module implement helper functions to read & write data
-- at bits level.
@@ -9,7 +10,9 @@
, getNextBitsLSBFirst
, getNextBitsMSBFirst
, getNextBitJpg
+ , getNextIntJpg
, setDecodedString
+ , setDecodedStringMSB
, setDecodedStringJpg
, runBoolReader
@@ -33,6 +36,7 @@
import Control.Monad( when )
import Control.Monad.ST( ST )
import qualified Control.Monad.Trans.State.Strict as S
+import Data.Int ( Int32 )
import Data.Word( Word8, Word32 )
import Data.Bits( (.&.), (.|.), unsafeShiftR, unsafeShiftL )
@@ -42,6 +46,7 @@
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L
+
--------------------------------------------------
---- Reader
--------------------------------------------------
@@ -93,8 +98,8 @@
BoolState idx _ chain <- S.get
when (idx /= 7) (setDecodedStringJpg chain)
-{-# INLINE getNextBitJpg #-}
getNextBitJpg :: BoolReader s Bool
+{-# INLINE getNextBitJpg #-}
getNextBitJpg = do
BoolState idx v chain <- S.get
let val = (v .&. (1 `unsafeShiftL` idx)) /= 0
@@ -103,25 +108,51 @@
else S.put $ BoolState (idx - 1) v chain
return val
-{-# INLINE getNextBitMSB #-}
-getNextBitMSB :: BoolReader s Bool
-getNextBitMSB = do
+getNextIntJpg :: Int -> BoolReader s Int32
+{-# INLINE getNextIntJpg #-}
+getNextIntJpg = go 0 where
+ go !acc !0 = return acc
+ go !acc !n = do
BoolState idx v chain <- S.get
- let val = (v .&. (1 `unsafeShiftL` (7 - idx))) /= 0
- if idx == 7
- then setDecodedString chain
- else S.put $ BoolState (idx + 1) v chain
- return val
+ let !leftBits = 1 + fromIntegral idx
+ if n >= leftBits then do
+ setDecodedStringJpg chain
+ let !remaining = n - leftBits
+ !mask = (1 `unsafeShiftL` leftBits) - 1
+ !finalV = fromIntegral v .&. mask
+ !theseBits = finalV `unsafeShiftL` remaining
+ go (acc .|. theseBits) remaining
+ else do
+ let !remaining = leftBits - n
+ !mask = (1 `unsafeShiftL` n) - 1
+ !finalV = fromIntegral v `unsafeShiftR` remaining
+ S.put $ BoolState (fromIntegral remaining - 1) v chain
+ return $ (finalV .&. mask) .|. acc
+
+
+setDecodedStringMSB :: B.ByteString -> BoolReader s ()
+setDecodedStringMSB str = case B.uncons str of
+ Nothing -> S.put $ BoolState 8 0 B.empty
+ Just (v, rest) -> S.put $ BoolState 8 v rest
+
{-# INLINE getNextBitsMSBFirst #-}
getNextBitsMSBFirst :: Int -> BoolReader s Word32
-getNextBitsMSBFirst = aux 0
- where aux acc 0 = return acc
- aux acc n = do
- bit <- getNextBitMSB
- let nextVal | bit = (acc `unsafeShiftL` 1) .|. 1
- | otherwise = acc `unsafeShiftL` 1
- aux nextVal (n - 1)
+getNextBitsMSBFirst requested = go 0 requested where
+ go :: Word32 -> Int -> BoolReader s Word32
+ go !acc !0 = return acc
+ go !acc !n = do
+ BoolState idx v chain <- S.get
+ let !leftBits = fromIntegral idx
+ if n >= leftBits then do
+ setDecodedStringMSB chain
+ let !theseBits = fromIntegral v `unsafeShiftL` (n - leftBits)
+ go (acc .|. theseBits) (n - leftBits)
+ else do
+ let !remaining = leftBits - n
+ !mask = (1 `unsafeShiftL` remaining) - 1
+ S.put $ BoolState (fromIntegral remaining) (v .&. mask) chain
+ return $ (fromIntegral v `unsafeShiftR` remaining) .|. acc
{-# INLINE getNextBitsLSBFirst #-}
getNextBitsLSBFirst :: Int -> BoolReader s Word32
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/src/Codec/Picture/Bitmap.hs new/JuicyPixels-3.2.7/src/Codec/Picture/Bitmap.hs
--- old/JuicyPixels-3.2.6.4/src/Codec/Picture/Bitmap.hs 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/src/Codec/Picture/Bitmap.hs 2016-01-25 23:33:56.000000000 +0100
@@ -41,6 +41,7 @@
, getWord8
, getWord16le
, getWord32le
+ , getWord32be
, bytesRead
, skip
)
@@ -253,6 +254,34 @@
inner 0 0 initialIndex
VS.unsafeFreeze buff
+decodeImageRGBA8 :: BmpInfoHeader -> (Int, Int, Int, Int) -> B.ByteString -> Image PixelRGBA8
+decodeImageRGBA8 (BmpInfoHeader { width = w, height = h }) (posR, posG, posB, posA) str = Image wi hi stArray where
+ wi = fromIntegral w
+ hi = abs $ fromIntegral h
+ stArray = runST $ do
+ arr <- M.new (fromIntegral $ w * abs h * 4)
+ if h > 0 then
+ foldM_ (readLine arr) 0 [0 .. hi - 1]
+ else
+ foldM_ (readLine arr) 0 [hi - 1, hi - 2 .. 0]
+ VS.unsafeFreeze arr
+
+ stride = linePadding 32 wi -- will be 0
+
+ readLine :: forall s. M.MVector s Word8 -> Int -> Int -> ST s Int
+ readLine arr readIndex line = inner readIndex writeIndex where
+ lastIndex = wi * (hi - 1 - line + 1) * 4
+ writeIndex = wi * (hi - 1 - line) * 4
+
+ inner readIdx writeIdx | writeIdx >= lastIndex = return $ readIdx + stride
+ inner readIdx writeIdx = do
+ -- 32-bit BMP pixels are BGRA
+ (arr `M.unsafeWrite` writeIdx ) (str `B.index` (readIdx + posR))
+ (arr `M.unsafeWrite` (writeIdx + 1)) (str `B.index` (readIdx + posG))
+ (arr `M.unsafeWrite` (writeIdx + 2)) (str `B.index` (readIdx + posB))
+ (arr `M.unsafeWrite` (writeIdx + 3)) (str `B.index` (readIdx + posA))
+ inner (readIdx + 4) (writeIdx + 4)
+
decodeImageRGB8 :: BmpInfoHeader -> B.ByteString -> Image PixelRGB8
decodeImageRGB8 (BmpInfoHeader { width = w, height = h }) str = Image wi hi stArray where
wi = fromIntegral w
@@ -322,6 +351,8 @@
-- | Try to decode a bitmap image.
-- Right now this function can output the following pixel types :
--
+-- * PixelRGBA8
+--
-- * PixelRGB8
--
-- * Pixel8
@@ -349,27 +380,49 @@
paletteColorCount
| colorCount bmpHeader == 0 = 2 ^ bpp
| otherwise = fromIntegral $ colorCount bmpHeader
+ getData = do
+ readed' <- bytesRead
+ skip . fromIntegral $ dataOffset hdr - fromIntegral readed'
+ getRemainingBytes
+ addMetadata i = (i, metadataOfHeader bmpHeader)
- table <- if bpp > 8
- then return V.empty
- else V.replicateM paletteColorCount pixelGet
-
- readed' <- bytesRead
-
- skip . fromIntegral $ dataOffset hdr - fromIntegral readed'
- rest <- getRemainingBytes
- let addMetadata i = (i, metadataOfHeader bmpHeader)
case (bitPerPixel bmpHeader, planes bmpHeader,
bitmapCompression bmpHeader) of
- -- (32, 1, 0) -> {- ImageRGBA8 <$>-} fail "Meuh"
- (24, 1, 0) -> return . addMetadata . ImageRGB8 $ decodeImageRGB8 bmpHeader rest
- ( 8, 1, 0) ->
- let indexer v = table V.! fromIntegral v in
- return . addMetadata . ImageRGB8 . pixelMap indexer $ decodeImageY8 bmpHeader rest
+ (32, 1, 0) -> do
+ rest <- getData
+ return . addMetadata . ImageRGBA8 $ decodeImageRGBA8 bmpHeader (2, 1, 0, 3) rest
+ -- (2, 1, 0, 3) means BGRA pixel order
+ (32, 1, 3) -> do
+ posRed <- getBitfield
+ posGreen <- getBitfield
+ posBlue <- getBitfield
+ posAlpha <- getBitfield
+ rest <- getData
+ return . addMetadata . ImageRGBA8 $
+ decodeImageRGBA8 bmpHeader (posRed, posGreen, posBlue, posAlpha) rest
+ (24, 1, 0) -> do
+ rest <- getData
+ return . addMetadata . ImageRGB8 $ decodeImageRGB8 bmpHeader rest
+ ( 8, 1, 0) -> do
+ table <- V.replicateM paletteColorCount pixelGet
+ rest <- getData
+ let indexer v = table V.! fromIntegral v
+ return . addMetadata . ImageRGB8 . pixelMap indexer $ decodeImageY8 bmpHeader rest
a -> fail $ "Can't handle BMP file " ++ show a
+getBitfield :: Get Int
+getBitfield = do
+ w32 <- getWord32be
+ case w32 of
+ 0xFF000000 -> return 0
+ 0x00FF0000 -> return 1
+ 0x0000FF00 -> return 2
+ 0x000000FF -> return 3
+ _ -> fail $
+ "Codec.Picture.Bitmap.getBitfield: unsupported bitfield of " ++ show w32
+
-- | Write an image in a file use the bitmap format.
writeBitmap :: (BmpEncodable pixel)
=> FilePath -> Image pixel -> IO ()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/src/Codec/Picture/Gif/LZW.hs new/JuicyPixels-3.2.7/src/Codec/Picture/Gif/LZW.hs
--- old/JuicyPixels-3.2.6.4/src/Codec/Picture/Gif/LZW.hs 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/src/Codec/Picture/Gif/LZW.hs 2016-01-25 23:33:57.000000000 +0100
@@ -1,191 +1,194 @@
-{-# LANGUAGE CPP #-}
-module Codec.Picture.Gif.LZW( decodeLzw, decodeLzwTiff ) where
-
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative( (<$>) )
-#endif
-
-import Data.Word( Word8 )
-import Control.Monad( when, unless )
-
-import Data.Bits( (.&.) )
-
-import Control.Monad.ST( ST )
-import Control.Monad.Trans.Class( MonadTrans, lift )
-
-import Foreign.Storable ( Storable )
-
-import qualified Data.ByteString as B
-import qualified Data.Vector.Storable.Mutable as M
-
-import Codec.Picture.BitWriter
-
-{-# INLINE (.!!!.) #-}
-(.!!!.) :: (Storable a) => M.STVector s a -> Int -> ST s a
-(.!!!.) = M.unsafeRead
- {-M.read-}
-
-{-# INLINE (..!!!..) #-}
-(..!!!..) :: (MonadTrans t, Storable a)
- => M.STVector s a -> Int -> t (ST s) a
-(..!!!..) v idx = lift $ v .!!!. idx
-
-{-# INLINE (.<-.) #-}
-(.<-.) :: (Storable a) => M.STVector s a -> Int -> a -> ST s ()
-(.<-.) = M.unsafeWrite
- {-M.write-}
-
-{-# INLINE (..<-..) #-}
-(..<-..) :: (MonadTrans t, Storable a)
- => M.STVector s a -> Int -> a -> t (ST s) ()
-(..<-..) v idx = lift . (v .<-. idx)
-
-
-duplicateData :: (Show a, MonadTrans t, Storable a)
- => M.STVector s a -> M.STVector s a
- -> Int -> Int -> Int -> t (ST s) ()
-duplicateData src dest sourceIndex size destIndex = lift $ aux sourceIndex destIndex
- where endIndex = sourceIndex + size
- aux i _ | i == endIndex = return ()
- aux i j = do
- src .!!!. i >>= (dest .<-. j)
- aux (i + 1) (j + 1)
-
-rangeSetter :: (Storable a, Num a)
- => Int -> M.STVector s a
- -> ST s (M.STVector s a)
-rangeSetter count vec = aux 0
- where aux n | n == count = return vec
- aux n = (vec .<-. n) (fromIntegral n) >> aux (n + 1)
-
-decodeLzw :: B.ByteString -> Int -> Int -> M.STVector s Word8
- -> BoolReader s ()
-decodeLzw str maxBitKey initialKey outVec = do
- setDecodedString str
- lzw GifVariant maxBitKey initialKey 0 outVec
-
-isOldTiffLZW :: B.ByteString -> Bool
-isOldTiffLZW str = firstByte == 0 && secondByte == 1
- where firstByte = str `B.index` 0
- secondByte = (str `B.index` 1) .&. 1
-
-decodeLzwTiff :: B.ByteString -> M.STVector s Word8 -> Int
- -> BoolReader s()
-decodeLzwTiff str outVec initialWriteIdx = do
- setDecodedString str
- let variant | isOldTiffLZW str = OldTiffVariant
- | otherwise = TiffVariant
- lzw variant 12 9 initialWriteIdx outVec
-
-data TiffVariant =
- GifVariant
- | TiffVariant
- | OldTiffVariant
- deriving Eq
-
--- | Gif image constraint from spec-gif89a, code size max : 12 bits.
-lzw :: TiffVariant -> Int -> Int -> Int -> M.STVector s Word8
- -> BoolReader s ()
-lzw variant nMaxBitKeySize initialKeySize initialWriteIdx outVec = do
- -- Allocate buffer of maximum size.
- lzwData <- lift (M.replicate maxDataSize 0) >>= resetArray
- lzwOffsetTable <- lift (M.replicate tableEntryCount 0) >>= resetArray
- lzwSizeTable <- lift $ M.replicate tableEntryCount 0
- lift $ lzwSizeTable `M.set` 1
-
- let firstVal code = do
- dataOffset <- lzwOffsetTable ..!!!.. code
- lzwData ..!!!.. dataOffset
-
- writeString at code = do
- dataOffset <- lzwOffsetTable ..!!!.. code
- dataSize <- lzwSizeTable ..!!!.. code
-
- when (at + dataSize <= maxWrite) $
- duplicateData lzwData outVec dataOffset dataSize at
-
- return dataSize
-
- addString pos at code val = do
- dataOffset <- lzwOffsetTable ..!!!.. code
- dataSize <- lzwSizeTable ..!!!.. code
-
- when (pos < tableEntryCount) $ do
- (lzwOffsetTable ..<-.. pos) at
- (lzwSizeTable ..<-.. pos) $ dataSize + 1
-
- when (at + dataSize + 1 <= maxDataSize) $ do
- duplicateData lzwData lzwData dataOffset dataSize at
- (lzwData ..<-.. (at + dataSize)) val
-
- return $ dataSize + 1
-
- maxWrite = M.length outVec
- loop outWriteIdx writeIdx dicWriteIdx codeSize oldCode code
- | outWriteIdx >= maxWrite = return ()
- | code == endOfInfo = return ()
- | code == clearCode = do
- toOutput <- getNextCode startCodeSize
- unless (toOutput == endOfInfo) $ do
- dataSize <- writeString outWriteIdx toOutput
- getNextCode startCodeSize >>=
- loop (outWriteIdx + dataSize)
- firstFreeIndex firstFreeIndex startCodeSize toOutput
-
- | otherwise = do
- (written, dicAdd) <-
- if code >= writeIdx then do
- c <- firstVal oldCode
- wroteSize <- writeString outWriteIdx oldCode
- (outVec ..<-.. (outWriteIdx + wroteSize)) c
- addedSize <- addString writeIdx dicWriteIdx oldCode c
- return (wroteSize + 1, addedSize)
- else do
- wroteSize <- writeString outWriteIdx code
- c <- firstVal code
- addedSize <- addString writeIdx dicWriteIdx oldCode c
- return (wroteSize, addedSize)
-
- let new_code_size = updateCodeSize codeSize $ writeIdx + 1
- getNextCode new_code_size >>=
- loop (outWriteIdx + written)
- (writeIdx + 1)
- (dicWriteIdx + dicAdd)
- new_code_size
- code
-
- getNextCode startCodeSize >>=
- loop initialWriteIdx firstFreeIndex firstFreeIndex startCodeSize 0
-
- where tableEntryCount = 2 ^ min 12 nMaxBitKeySize
- maxDataSize = tableEntryCount `div` 2 * (1 + tableEntryCount) + 1
-
- isNewTiff = variant == TiffVariant
- (switchOffset, isTiffVariant) = case variant of
- GifVariant -> (0, False)
- TiffVariant -> (1, True)
- OldTiffVariant -> (0, True)
-
- initialElementCount = 2 ^ initialKeySize :: Int
- clearCode | isTiffVariant = 256
- | otherwise = initialElementCount
-
- endOfInfo | isTiffVariant = 257
- | otherwise = clearCode + 1
-
- startCodeSize
- | isTiffVariant = initialKeySize
- | otherwise = initialKeySize + 1
-
- firstFreeIndex = endOfInfo + 1
-
- resetArray a = lift $ rangeSetter initialElementCount a
-
- updateCodeSize codeSize writeIdx
- | writeIdx == 2 ^ codeSize - switchOffset = min 12 $ codeSize + 1
- | otherwise = codeSize
-
- getNextCode s
- | isNewTiff = fromIntegral <$> getNextBitsMSBFirst s
- | otherwise = fromIntegral <$> getNextBitsLSBFirst s
-
+{-# LANGUAGE CPP #-}
+module Codec.Picture.Gif.LZW( decodeLzw, decodeLzwTiff ) where
+
+#if !MIN_VERSION_base(4,8,0)
+import Control.Applicative( (<$>) )
+#endif
+
+import Data.Word( Word8 )
+import Control.Monad( when, unless )
+
+import Data.Bits( (.&.) )
+
+import Control.Monad.ST( ST )
+import Control.Monad.Trans.Class( MonadTrans, lift )
+
+import Foreign.Storable ( Storable )
+
+import qualified Data.ByteString as B
+import qualified Data.Vector.Storable.Mutable as M
+
+import Codec.Picture.BitWriter
+
+{-# INLINE (.!!!.) #-}
+(.!!!.) :: (Storable a) => M.STVector s a -> Int -> ST s a
+(.!!!.) = M.unsafeRead
+ {-M.read-}
+
+{-# INLINE (..!!!..) #-}
+(..!!!..) :: (MonadTrans t, Storable a)
+ => M.STVector s a -> Int -> t (ST s) a
+(..!!!..) v idx = lift $ v .!!!. idx
+
+{-# INLINE (.<-.) #-}
+(.<-.) :: (Storable a) => M.STVector s a -> Int -> a -> ST s ()
+(.<-.) = M.unsafeWrite
+ {-M.write-}
+
+{-# INLINE (..<-..) #-}
+(..<-..) :: (MonadTrans t, Storable a)
+ => M.STVector s a -> Int -> a -> t (ST s) ()
+(..<-..) v idx = lift . (v .<-. idx)
+
+
+duplicateData :: (Show a, MonadTrans t, Storable a)
+ => M.STVector s a -> M.STVector s a
+ -> Int -> Int -> Int -> t (ST s) ()
+duplicateData src dest sourceIndex size destIndex = lift $ aux sourceIndex destIndex
+ where endIndex = sourceIndex + size
+ aux i _ | i == endIndex = return ()
+ aux i j = do
+ src .!!!. i >>= (dest .<-. j)
+ aux (i + 1) (j + 1)
+
+rangeSetter :: (Storable a, Num a)
+ => Int -> M.STVector s a
+ -> ST s (M.STVector s a)
+rangeSetter count vec = aux 0
+ where aux n | n == count = return vec
+ aux n = (vec .<-. n) (fromIntegral n) >> aux (n + 1)
+
+decodeLzw :: B.ByteString -> Int -> Int -> M.STVector s Word8
+ -> BoolReader s ()
+decodeLzw str maxBitKey initialKey outVec = do
+ setDecodedString str
+ lzw GifVariant maxBitKey initialKey 0 outVec
+
+isOldTiffLZW :: B.ByteString -> Bool
+isOldTiffLZW str = firstByte == 0 && secondByte == 1
+ where firstByte = str `B.index` 0
+ secondByte = (str `B.index` 1) .&. 1
+
+decodeLzwTiff :: B.ByteString -> M.STVector s Word8 -> Int
+ -> BoolReader s()
+decodeLzwTiff str outVec initialWriteIdx = do
+ if isOldTiffLZW str then
+ setDecodedString str
+ else
+ setDecodedStringMSB str
+ let variant | isOldTiffLZW str = OldTiffVariant
+ | otherwise = TiffVariant
+ lzw variant 12 9 initialWriteIdx outVec
+
+data TiffVariant =
+ GifVariant
+ | TiffVariant
+ | OldTiffVariant
+ deriving Eq
+
+-- | Gif image constraint from spec-gif89a, code size max : 12 bits.
+lzw :: TiffVariant -> Int -> Int -> Int -> M.STVector s Word8
+ -> BoolReader s ()
+lzw variant nMaxBitKeySize initialKeySize initialWriteIdx outVec = do
+ -- Allocate buffer of maximum size.
+ lzwData <- lift (M.replicate maxDataSize 0) >>= resetArray
+ lzwOffsetTable <- lift (M.replicate tableEntryCount 0) >>= resetArray
+ lzwSizeTable <- lift $ M.replicate tableEntryCount 0
+ lift $ lzwSizeTable `M.set` 1
+
+ let firstVal code = do
+ dataOffset <- lzwOffsetTable ..!!!.. code
+ lzwData ..!!!.. dataOffset
+
+ writeString at code = do
+ dataOffset <- lzwOffsetTable ..!!!.. code
+ dataSize <- lzwSizeTable ..!!!.. code
+
+ when (at + dataSize <= maxWrite) $
+ duplicateData lzwData outVec dataOffset dataSize at
+
+ return dataSize
+
+ addString pos at code val = do
+ dataOffset <- lzwOffsetTable ..!!!.. code
+ dataSize <- lzwSizeTable ..!!!.. code
+
+ when (pos < tableEntryCount) $ do
+ (lzwOffsetTable ..<-.. pos) at
+ (lzwSizeTable ..<-.. pos) $ dataSize + 1
+
+ when (at + dataSize + 1 <= maxDataSize) $ do
+ duplicateData lzwData lzwData dataOffset dataSize at
+ (lzwData ..<-.. (at + dataSize)) val
+
+ return $ dataSize + 1
+
+ maxWrite = M.length outVec
+ loop outWriteIdx writeIdx dicWriteIdx codeSize oldCode code
+ | outWriteIdx >= maxWrite = return ()
+ | code == endOfInfo = return ()
+ | code == clearCode = do
+ toOutput <- getNextCode startCodeSize
+ unless (toOutput == endOfInfo) $ do
+ dataSize <- writeString outWriteIdx toOutput
+ getNextCode startCodeSize >>=
+ loop (outWriteIdx + dataSize)
+ firstFreeIndex firstFreeIndex startCodeSize toOutput
+
+ | otherwise = do
+ (written, dicAdd) <-
+ if code >= writeIdx then do
+ c <- firstVal oldCode
+ wroteSize <- writeString outWriteIdx oldCode
+ (outVec ..<-.. (outWriteIdx + wroteSize)) c
+ addedSize <- addString writeIdx dicWriteIdx oldCode c
+ return (wroteSize + 1, addedSize)
+ else do
+ wroteSize <- writeString outWriteIdx code
+ c <- firstVal code
+ addedSize <- addString writeIdx dicWriteIdx oldCode c
+ return (wroteSize, addedSize)
+
+ let new_code_size = updateCodeSize codeSize $ writeIdx + 1
+ getNextCode new_code_size >>=
+ loop (outWriteIdx + written)
+ (writeIdx + 1)
+ (dicWriteIdx + dicAdd)
+ new_code_size
+ code
+
+ getNextCode startCodeSize >>=
+ loop initialWriteIdx firstFreeIndex firstFreeIndex startCodeSize 0
+
+ where tableEntryCount = 2 ^ min 12 nMaxBitKeySize
+ maxDataSize = tableEntryCount `div` 2 * (1 + tableEntryCount) + 1
+
+ isNewTiff = variant == TiffVariant
+ (switchOffset, isTiffVariant) = case variant of
+ GifVariant -> (0, False)
+ TiffVariant -> (1, True)
+ OldTiffVariant -> (0, True)
+
+ initialElementCount = 2 ^ initialKeySize :: Int
+ clearCode | isTiffVariant = 256
+ | otherwise = initialElementCount
+
+ endOfInfo | isTiffVariant = 257
+ | otherwise = clearCode + 1
+
+ startCodeSize
+ | isTiffVariant = initialKeySize
+ | otherwise = initialKeySize + 1
+
+ firstFreeIndex = endOfInfo + 1
+
+ resetArray a = lift $ rangeSetter initialElementCount a
+
+ updateCodeSize codeSize writeIdx
+ | writeIdx == 2 ^ codeSize - switchOffset = min 12 $ codeSize + 1
+ | otherwise = codeSize
+
+ getNextCode s
+ | isNewTiff = fromIntegral <$> getNextBitsMSBFirst s
+ | otherwise = fromIntegral <$> getNextBitsLSBFirst s
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/src/Codec/Picture/Jpg/Common.hs new/JuicyPixels-3.2.7/src/Codec/Picture/Jpg/Common.hs
--- old/JuicyPixels-3.2.6.4/src/Codec/Picture/Jpg/Common.hs 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/src/Codec/Picture/Jpg/Common.hs 2016-01-25 23:33:57.000000000 +0100
@@ -23,11 +23,10 @@
import Control.Applicative( pure, (<$>) )
#endif
-import Control.Monad( replicateM, when )
+import Control.Monad( when )
import Control.Monad.ST( ST, runST )
import Data.Bits( unsafeShiftL, unsafeShiftR, (.&.) )
import Data.Int( Int16, Int32 )
-import Data.List( foldl' )
import Data.Maybe( fromMaybe )
import Data.Word( Word8 )
import qualified Data.Vector.Storable as VS
@@ -174,8 +173,7 @@
-- | Unpack an int of the given size encoded from MSB to LSB.
unpackInt :: Int -> BoolReader s Int32
-unpackInt bitCount = packInt <$> replicateM bitCount getNextBitJpg
-
+unpackInt = getNextIntJpg
{-# INLINE rasterMap #-}
rasterMap :: (Monad m)
@@ -187,11 +185,6 @@
where columner x | x >= width = liner (y + 1)
columner x = f x y >> columner (x + 1)
-packInt :: [Bool] -> Int32
-packInt = foldl' bitStep 0
- where bitStep acc True = (acc `unsafeShiftL` 1) + 1
- bitStep acc False = acc `unsafeShiftL` 1
-
pixelClamp :: Int16 -> Word8
pixelClamp n = fromIntegral . min 255 $ max 0 n
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/src/Codec/Picture/Jpg/Types.hs new/JuicyPixels-3.2.7/src/Codec/Picture/Jpg/Types.hs
--- old/JuicyPixels-3.2.6.4/src/Codec/Picture/Jpg/Types.hs 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/src/Codec/Picture/Jpg/Types.hs 2016-01-25 23:33:57.000000000 +0100
@@ -427,7 +427,8 @@
getByteString (fromIntegral size - 2)
putFrame :: JpgFrame -> Put
-putFrame (JpgAdobeAPP14 _adobe) = return ()
+putFrame (JpgAdobeAPP14 adobe) =
+ put (JpgAppSegment 14) >> putWord16be 14 >> put adobe
putFrame (JpgJFIF jfif) =
put (JpgAppSegment 0) >> putWord16be (14+2) >> put jfif
putFrame (JpgExif _exif) =
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/src/Codec/Picture/Jpg.hs new/JuicyPixels-3.2.7/src/Codec/Picture/Jpg.hs
--- old/JuicyPixels-3.2.6.4/src/Codec/Picture/Jpg.hs 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/src/Codec/Picture/Jpg.hs 2016-01-25 23:33:56.000000000 +0100
@@ -11,7 +11,9 @@
, decodeJpegWithMetadata
, encodeJpegAtQuality
, encodeJpegAtQualityWithMetadata
+ , encodeDirectJpegAtQualityWithMetadata
, encodeJpeg
+ , JpgEncodable
) where
#if !MIN_VERSION_base(4,8,0)
@@ -546,6 +548,8 @@
--
-- * PixelRGB8
--
+-- * PixelCMYK8
+--
-- * PixelYCbCr8
--
decodeJpeg :: B.ByteString -> Either String DynamicImage
@@ -623,7 +627,8 @@
frozen <- unsafeFreezeImage fImg
return (st, imageData frozen)
-extractBlock :: Image PixelYCbCr8 -- ^ Source image
+extractBlock :: forall s px. (PixelBaseComponent px ~ Word8)
+ => Image px -- ^ Source image
-> MutableMacroBlock s Int16 -- ^ Mutable block where to put extracted block
-> Int -- ^ Plane
-> Int -- ^ X sampling factor
@@ -741,6 +746,22 @@
, prepareHuffmanTable AcComponent 1 defaultAcChromaHuffmanTable
]
+lumaQuantTableAtQuality :: Int -> QuantificationTable
+lumaQuantTableAtQuality qual = scaleQuantisationMatrix qual defaultLumaQuantizationTable
+
+chromaQuantTableAtQuality :: Int -> QuantificationTable
+chromaQuantTableAtQuality qual =
+ scaleQuantisationMatrix qual defaultChromaQuantizationTable
+
+zigzaggedQuantificationSpec :: Int -> [JpgQuantTableSpec]
+zigzaggedQuantificationSpec qual =
+ [ JpgQuantTableSpec { quantPrecision = 0, quantDestination = 0, quantTable = luma }
+ , JpgQuantTableSpec { quantPrecision = 0, quantDestination = 1, quantTable = chroma }
+ ]
+ where
+ luma = zigZagReorderForwardv $ lumaQuantTableAtQuality qual
+ chroma = zigZagReorderForwardv $ chromaQuantTableAtQuality qual
+
-- | Function to call to encode an image to jpeg.
-- The quality factor should be between 0 and 100 (100 being
-- the best quality).
@@ -749,6 +770,203 @@
-> L.ByteString -- ^ Encoded JPEG
encodeJpegAtQuality quality = encodeJpegAtQualityWithMetadata quality mempty
+-- | Record gathering all information to encode a component
+-- from the source image. Previously was a huge tuple
+-- burried in the code
+data EncoderState = EncoderState
+ { _encComponentIndex :: !Int
+ , _encBlockWidth :: !Int
+ , _encBlockHeight :: !Int
+ , _encQuantTable :: !QuantificationTable
+ , _encDcHuffman :: !HuffmanWriterCode
+ , _encAcHuffman :: !HuffmanWriterCode
+ }
+
+
+-- | Helper type class describing all JPG-encodable pixel types
+class (Pixel px, PixelBaseComponent px ~ Word8) => JpgEncodable px where
+ additionalBlocks :: Image px -> [JpgFrame]
+ additionalBlocks _ = []
+
+ componentsOfColorSpace :: Image px -> [JpgComponent]
+
+ encodingState :: Int -> Image px -> V.Vector EncoderState
+
+ imageHuffmanTables :: Image px -> [(JpgHuffmanTableSpec, HuffmanPackedTree)]
+ imageHuffmanTables _ = defaultHuffmanTables
+
+ scanSpecificationOfColorSpace :: Image px -> [JpgScanSpecification]
+
+ quantTableSpec :: Image px -> Int -> [JpgQuantTableSpec]
+ quantTableSpec _ qual = take 1 $ zigzaggedQuantificationSpec qual
+
+ maximumSubSamplingOf :: Image px -> Int
+ maximumSubSamplingOf _ = 1
+
+instance JpgEncodable Pixel8 where
+ scanSpecificationOfColorSpace _ =
+ [ JpgScanSpecification { componentSelector = 1
+ , dcEntropyCodingTable = 0
+ , acEntropyCodingTable = 0
+ }
+ ]
+
+ componentsOfColorSpace _ =
+ [ JpgComponent { componentIdentifier = 1
+ , horizontalSamplingFactor = 1
+ , verticalSamplingFactor = 1
+ , quantizationTableDest = 0
+ }
+ ]
+
+ imageHuffmanTables _ =
+ [ prepareHuffmanTable DcComponent 0 defaultDcLumaHuffmanTable
+ , prepareHuffmanTable AcComponent 0 defaultAcLumaHuffmanTable
+ ]
+
+ encodingState qual _ = V.singleton EncoderState
+ { _encComponentIndex = 0
+ , _encBlockWidth = 1
+ , _encBlockHeight = 1
+ , _encQuantTable = zigZagReorderForwardv $ lumaQuantTableAtQuality qual
+ , _encDcHuffman = makeInverseTable defaultDcLumaHuffmanTree
+ , _encAcHuffman = makeInverseTable defaultAcLumaHuffmanTree
+ }
+
+
+instance JpgEncodable PixelYCbCr8 where
+ maximumSubSamplingOf _ = 2
+ quantTableSpec _ qual = zigzaggedQuantificationSpec qual
+ scanSpecificationOfColorSpace _ =
+ [ JpgScanSpecification { componentSelector = 1
+ , dcEntropyCodingTable = 0
+ , acEntropyCodingTable = 0
+ }
+ , JpgScanSpecification { componentSelector = 2
+ , dcEntropyCodingTable = 1
+ , acEntropyCodingTable = 1
+ }
+ , JpgScanSpecification { componentSelector = 3
+ , dcEntropyCodingTable = 1
+ , acEntropyCodingTable = 1
+ }
+ ]
+
+ componentsOfColorSpace _ =
+ [ JpgComponent { componentIdentifier = 1
+ , horizontalSamplingFactor = 2
+ , verticalSamplingFactor = 2
+ , quantizationTableDest = 0
+ }
+ , JpgComponent { componentIdentifier = 2
+ , horizontalSamplingFactor = 1
+ , verticalSamplingFactor = 1
+ , quantizationTableDest = 1
+ }
+ , JpgComponent { componentIdentifier = 3
+ , horizontalSamplingFactor = 1
+ , verticalSamplingFactor = 1
+ , quantizationTableDest = 1
+ }
+ ]
+
+ encodingState qual _ = V.fromListN 3 [lumaState, chromaState, chromaState { _encComponentIndex = 2 }]
+ where
+ lumaState = EncoderState
+ { _encComponentIndex = 0
+ , _encBlockWidth = 2
+ , _encBlockHeight = 2
+ , _encQuantTable = zigZagReorderForwardv $ lumaQuantTableAtQuality qual
+ , _encDcHuffman = makeInverseTable defaultDcLumaHuffmanTree
+ , _encAcHuffman = makeInverseTable defaultAcLumaHuffmanTree
+ }
+ chromaState = EncoderState
+ { _encComponentIndex = 1
+ , _encBlockWidth = 1
+ , _encBlockHeight = 1
+ , _encQuantTable = zigZagReorderForwardv $ chromaQuantTableAtQuality qual
+ , _encDcHuffman = makeInverseTable defaultDcChromaHuffmanTree
+ , _encAcHuffman = makeInverseTable defaultAcChromaHuffmanTree
+ }
+
+instance JpgEncodable PixelRGB8 where
+ additionalBlocks _ = [] where
+ _adobe14 = JpgAdobeApp14
+ { _adobeDctVersion = 100
+ , _adobeFlag0 = 0
+ , _adobeFlag1 = 0
+ , _adobeTransform = AdobeUnknown
+ }
+
+ imageHuffmanTables _ =
+ [ prepareHuffmanTable DcComponent 0 defaultDcLumaHuffmanTable
+ , prepareHuffmanTable AcComponent 0 defaultAcLumaHuffmanTable
+ ]
+
+ scanSpecificationOfColorSpace _ = fmap build "RGB" where
+ build c = JpgScanSpecification
+ { componentSelector = fromIntegral $ fromEnum c
+ , dcEntropyCodingTable = 0
+ , acEntropyCodingTable = 0
+ }
+
+ componentsOfColorSpace _ = fmap build "RGB" where
+ build c = JpgComponent
+ { componentIdentifier = fromIntegral $ fromEnum c
+ , horizontalSamplingFactor = 1
+ , verticalSamplingFactor = 1
+ , quantizationTableDest = 0
+ }
+
+ encodingState qual _ = V.fromListN 3 $ fmap build [0 .. 2] where
+ build ix = EncoderState
+ { _encComponentIndex = ix
+ , _encBlockWidth = 1
+ , _encBlockHeight = 1
+ , _encQuantTable = zigZagReorderForwardv $ lumaQuantTableAtQuality qual
+ , _encDcHuffman = makeInverseTable defaultDcLumaHuffmanTree
+ , _encAcHuffman = makeInverseTable defaultAcLumaHuffmanTree
+ }
+
+instance JpgEncodable PixelCMYK8 where
+ additionalBlocks _ = [] where
+ _adobe14 = JpgAdobeApp14
+ { _adobeDctVersion = 100
+ , _adobeFlag0 = 32768
+ , _adobeFlag1 = 0
+ , _adobeTransform = AdobeYCck
+ }
+
+ imageHuffmanTables _ =
+ [ prepareHuffmanTable DcComponent 0 defaultDcLumaHuffmanTable
+ , prepareHuffmanTable AcComponent 0 defaultAcLumaHuffmanTable
+ ]
+
+ scanSpecificationOfColorSpace _ = fmap build "CMYK" where
+ build c = JpgScanSpecification
+ { componentSelector = fromIntegral $ fromEnum c
+ , dcEntropyCodingTable = 0
+ , acEntropyCodingTable = 0
+ }
+
+ componentsOfColorSpace _ = fmap build "CMYK" where
+ build c = JpgComponent
+ { componentIdentifier = fromIntegral $ fromEnum c
+ , horizontalSamplingFactor = 1
+ , verticalSamplingFactor = 1
+ , quantizationTableDest = 0
+ }
+
+ encodingState qual _ = V.fromListN 4 $ fmap build [0 .. 3] where
+ build ix = EncoderState
+ { _encComponentIndex = ix
+ , _encBlockWidth = 1
+ , _encBlockHeight = 1
+ , _encQuantTable = zigZagReorderForwardv $ lumaQuantTableAtQuality qual
+ , _encDcHuffman = makeInverseTable defaultDcLumaHuffmanTree
+ , _encAcHuffman = makeInverseTable defaultAcLumaHuffmanTree
+ }
+
-- | Equivalent to 'encodeJpegAtQuality', but will store the following
-- metadatas in the file using a JFIF block:
--
@@ -759,121 +977,86 @@
-> Metadatas
-> Image PixelYCbCr8 -- ^ Image to encode
-> L.ByteString -- ^ Encoded JPEG
-encodeJpegAtQualityWithMetadata quality metas img@(Image { imageWidth = w, imageHeight = h }) = encode finalImage
- where finalImage = JpgImage $
- encodeMetadatas metas ++
- [ JpgQuantTable quantTables
- , JpgScans JpgBaselineDCTHuffman hdr
- , JpgHuffmanTable defaultHuffmanTables
- , JpgScanBlob scanHeader encodedImage
- ]
-
- outputComponentCount = 3
-
- scanHeader = scanHeader'{ scanLength = fromIntegral $ calculateSize scanHeader' }
- scanHeader' = JpgScanHeader
- { scanLength = 0
- , scanComponentCount = outputComponentCount
- , scans = [ JpgScanSpecification { componentSelector = 1
- , dcEntropyCodingTable = 0
- , acEntropyCodingTable = 0
- }
- , JpgScanSpecification { componentSelector = 2
- , dcEntropyCodingTable = 1
- , acEntropyCodingTable = 1
- }
- , JpgScanSpecification { componentSelector = 3
- , dcEntropyCodingTable = 1
- , acEntropyCodingTable = 1
- }
- ]
-
- , spectralSelection = (0, 63)
- , successiveApproxHigh = 0
- , successiveApproxLow = 0
- }
-
- hdr = hdr' { jpgFrameHeaderLength = fromIntegral $ calculateSize hdr' }
- hdr' = JpgFrameHeader { jpgFrameHeaderLength = 0
- , jpgSamplePrecision = 8
- , jpgHeight = fromIntegral h
- , jpgWidth = fromIntegral w
- , jpgImageComponentCount = outputComponentCount
- , jpgComponents = [
- JpgComponent { componentIdentifier = 1
- , horizontalSamplingFactor = 2
- , verticalSamplingFactor = 2
- , quantizationTableDest = 0
- }
- , JpgComponent { componentIdentifier = 2
- , horizontalSamplingFactor = 1
- , verticalSamplingFactor = 1
- , quantizationTableDest = 1
- }
- , JpgComponent { componentIdentifier = 3
- , horizontalSamplingFactor = 1
- , verticalSamplingFactor = 1
- , quantizationTableDest = 1
- }
- ]
- }
-
- lumaQuant = scaleQuantisationMatrix (fromIntegral quality)
- defaultLumaQuantizationTable
- chromaQuant = scaleQuantisationMatrix (fromIntegral quality)
- defaultChromaQuantizationTable
-
- zigzagedLumaQuant = zigZagReorderForwardv lumaQuant
- zigzagedChromaQuant = zigZagReorderForwardv chromaQuant
- quantTables = [ JpgQuantTableSpec { quantPrecision = 0, quantDestination = 0
- , quantTable = zigzagedLumaQuant }
- , JpgQuantTableSpec { quantPrecision = 0, quantDestination = 1
- , quantTable = zigzagedChromaQuant }
- ]
-
- encodedImage = runST $ do
- let horizontalMetaBlockCount =
- w `divUpward` (dctBlockSize * maxSampling)
- verticalMetaBlockCount =
- h `divUpward` (dctBlockSize * maxSampling)
- maxSampling = 2
- lumaSamplingSize = ( maxSampling, maxSampling, zigzagedLumaQuant
- , makeInverseTable defaultDcLumaHuffmanTree
- , makeInverseTable defaultAcLumaHuffmanTree)
- chromaSamplingSize = ( maxSampling - 1, maxSampling - 1, zigzagedChromaQuant
- , makeInverseTable defaultDcChromaHuffmanTree
- , makeInverseTable defaultAcChromaHuffmanTree)
- componentDef = [lumaSamplingSize, chromaSamplingSize, chromaSamplingSize]
-
- imageComponentCount = length componentDef
-
- dc_table <- M.replicate 3 0
- block <- createEmptyMutableMacroBlock
- workData <- createEmptyMutableMacroBlock
- zigzaged <- createEmptyMutableMacroBlock
- writeState <- newWriteStateRef
-
- -- It's ugly, I know, be avoid allocation
- let blockDecoder mx my = component $ zip [0..] componentDef
- where component [] = return ()
- component ((comp, (sizeX, sizeY, table, dc, ac)) : comp_rest) =
- rasterMap sizeX sizeY decoder >> component comp_rest
- where xSamplingFactor = maxSampling - sizeX + 1
- ySamplingFactor = maxSampling - sizeY + 1
- extractor = extractBlock img block xSamplingFactor ySamplingFactor imageComponentCount
-
- decoder subX subY = do
- let blockY = my * sizeY + subY
- blockX = mx * sizeX + subX
- prev_dc <- dc_table `M.unsafeRead` comp
- (dc_coeff, neo_block) <- extractor comp blockX blockY >>=
- encodeMacroBlock table workData zigzaged prev_dc
- (dc_table `M.unsafeWrite` comp) $ fromIntegral dc_coeff
- serializeMacroBlock writeState dc ac neo_block
-
- rasterMap
- horizontalMetaBlockCount verticalMetaBlockCount
- blockDecoder
+encodeJpegAtQualityWithMetadata = encodeDirectJpegAtQualityWithMetadata
+
+-- | Equivalent to 'encodeJpegAtQuality', but will store the following
+-- metadatas in the file using a JFIF block:
+--
+-- * 'Codec.Picture.Metadata.DpiX'
+-- * 'Codec.Picture.Metadata.DpiY'
+--
+-- This function also allow to create JPEG files with the following color
+-- space:
+--
+-- * Y (Pixel8) for greyscale.
+-- * RGB (PixelRGB8) with no color downsampling on any plane
+-- * CMYK (PixelCMYK8) with no color downsampling on any plane
+--
+encodeDirectJpegAtQualityWithMetadata :: forall px. (JpgEncodable px)
+ => Word8 -- ^ Quality factor
+ -> Metadatas
+ -> Image px -- ^ Image to encode
+ -> L.ByteString -- ^ Encoded JPEG
+encodeDirectJpegAtQualityWithMetadata quality metas img = encode finalImage where
+ !w = imageWidth img
+ !h = imageHeight img
+ finalImage = JpgImage $
+ encodeMetadatas metas ++
+ additionalBlocks img ++
+ [ JpgQuantTable $ quantTableSpec img (fromIntegral quality)
+ , JpgScans JpgBaselineDCTHuffman hdr
+ , JpgHuffmanTable $ imageHuffmanTables img
+ , JpgScanBlob scanHeader encodedImage
+ ]
+
+ !outputComponentCount = componentCount (undefined :: px)
+
+ scanHeader = scanHeader'{ scanLength = fromIntegral $ calculateSize scanHeader' }
+ scanHeader' = JpgScanHeader
+ { scanLength = 0
+ , scanComponentCount = fromIntegral outputComponentCount
+ , scans = scanSpecificationOfColorSpace img
+ , spectralSelection = (0, 63)
+ , successiveApproxHigh = 0
+ , successiveApproxLow = 0
+ }
+
+ hdr = hdr' { jpgFrameHeaderLength = fromIntegral $ calculateSize hdr' }
+ hdr' = JpgFrameHeader
+ { jpgFrameHeaderLength = 0
+ , jpgSamplePrecision = 8
+ , jpgHeight = fromIntegral h
+ , jpgWidth = fromIntegral w
+ , jpgImageComponentCount = fromIntegral outputComponentCount
+ , jpgComponents = componentsOfColorSpace img
+ }
+
+ !maxSampling = maximumSubSamplingOf img
+ !horizontalMetaBlockCount = w `divUpward` (dctBlockSize * maxSampling)
+ !verticalMetaBlockCount = h `divUpward` (dctBlockSize * maxSampling)
+ !componentDef = encodingState (fromIntegral quality) img
+
+ encodedImage = runST $ do
+ dc_table <- M.replicate outputComponentCount 0
+ block <- createEmptyMutableMacroBlock
+ workData <- createEmptyMutableMacroBlock
+ zigzaged <- createEmptyMutableMacroBlock
+ writeState <- newWriteStateRef
+
+ rasterMap horizontalMetaBlockCount verticalMetaBlockCount $ \mx my ->
+ V.forM_ componentDef $ \(EncoderState comp sizeX sizeY table dc ac) ->
+ let !xSamplingFactor = maxSampling - sizeX + 1
+ !ySamplingFactor = maxSampling - sizeY + 1
+ !extractor = extractBlock img block xSamplingFactor ySamplingFactor outputComponentCount
+ in
+ rasterMap sizeX sizeY $ \subX subY -> do
+ let !blockY = my * sizeY + subY
+ !blockX = mx * sizeX + subX
+ prev_dc <- dc_table `M.unsafeRead` comp
+ extracted <- extractor comp blockX blockY
+ (dc_coeff, neo_block) <- encodeMacroBlock table workData zigzaged prev_dc extracted
+ (dc_table `M.unsafeWrite` comp) $ fromIntegral dc_coeff
+ serializeMacroBlock writeState dc ac neo_block
- finalizeBoolWriter writeState
+ finalizeBoolWriter writeState
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/src/Codec/Picture/Saving.hs new/JuicyPixels-3.2.7/src/Codec/Picture/Saving.hs
--- old/JuicyPixels-3.2.6.4/src/Codec/Picture/Saving.hs 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/src/Codec/Picture/Saving.hs 2016-01-25 23:33:57.000000000 +0100
@@ -1,4 +1,5 @@
{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE CPP #-}
-- | Helper functions to save dynamic images to other file format
-- with automatic color space/sample format conversion done automatically.
module Codec.Picture.Saving( imageToJpg
@@ -10,6 +11,10 @@
, imageToTga
) where
+#if !MIN_VERSION_base(4,8,0)
+import Data.Monoid( mempty )
+#endif
+
import Data.Bits( unsafeShiftR )
import Data.Word( Word8, Word16 )
import qualified Data.ByteString.Lazy as L
@@ -94,9 +99,13 @@
-- | This function will try to do anything to encode an image
-- as JPEG, make all color conversion and such. Equivalent
-- of 'decodeImage' for jpeg encoding
+-- Save Y or YCbCr Jpeg only, all other colorspaces are converted.
+-- To save a RGB or CMYK JPEG file, use the
+-- 'Codec.Picture.Jpg.encodeDirectJpegAtQualityWithMetadata' function
imageToJpg :: Int -> DynamicImage -> L.ByteString
imageToJpg quality dynImage =
let encodeAtQuality = encodeJpegAtQuality (fromIntegral quality)
+ encodeWithMeta = encodeDirectJpegAtQualityWithMetadata (fromIntegral quality) mempty
in case dynImage of
ImageYCbCr8 img -> encodeAtQuality img
ImageCMYK8 img -> imageToJpg quality . ImageRGB8 $ convertImage img
@@ -105,10 +114,8 @@
ImageRGBF img -> imageToJpg quality . ImageRGB8 $ toStandardDef img
ImageRGBA8 img -> encodeAtQuality (convertImage $ dropAlphaLayer img)
ImageYF img -> imageToJpg quality . ImageY8 $ greyScaleToStandardDef img
- ImageY8 img -> encodeAtQuality . convertImage
- $ (promoteImage img :: Image PixelRGB8)
- ImageYA8 img -> encodeAtQuality $
- convertImage (promoteImage $ dropAlphaLayer img :: Image PixelRGB8)
+ ImageY8 img -> encodeWithMeta img
+ ImageYA8 img -> encodeWithMeta $ dropAlphaLayer img
ImageY16 img -> imageToJpg quality . ImageY8 $ from16to8 img
ImageYA16 img -> imageToJpg quality . ImageYA8 $ from16to8 img
ImageRGB16 img -> imageToJpg quality . ImageRGB8 $ from16to8 img
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/src/Codec/Picture/Types.hs new/JuicyPixels-3.2.7/src/Codec/Picture/Types.hs
--- old/JuicyPixels-3.2.6.4/src/Codec/Picture/Types.hs 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/src/Codec/Picture/Types.hs 2016-01-25 23:33:57.000000000 +0100
@@ -739,7 +739,7 @@
-> Int -- ^ Height in pixels
-> m (MutableImage (PrimState m) px)
{-# INLINE generateMutableImage #-}
-generateMutableImage f w h = MutableImage w h <$> generated where
+generateMutableImage f w h = MutableImage w h `liftM` generated where
compCount = componentCount (undefined :: px)
generated = do
@@ -897,6 +897,7 @@
{-# SPECIALIZE INLINE pixelMap :: (PixelRGB8 -> PixelRGBA8) -> Image PixelRGB8 -> Image PixelRGBA8 #-}
{-# SPECIALIZE INLINE pixelMap :: (PixelRGBA8 -> PixelRGBA8) -> Image PixelRGBA8 -> Image PixelRGBA8 #-}
{-# SPECIALIZE INLINE pixelMap :: (Pixel8 -> PixelRGB8) -> Image Pixel8 -> Image PixelRGB8 #-}
+{-# SPECIALIZE INLINE pixelMap :: (Pixel8 -> Pixel8) -> Image Pixel8 -> Image Pixel8 #-}
pixelMap f Image { imageWidth = w, imageHeight = h, imageData = vec } =
Image w h pixels
where sourceComponentCount = componentCount (undefined :: a)
@@ -1105,9 +1106,10 @@
instance LumaPlaneExtractable PixelRGBA8 where
{-# INLINE computeLuma #-}
- computeLuma (PixelRGBA8 r g b _) = floor $ 0.3 * toRational r +
- 0.59 * toRational g +
- 0.11 * toRational b
+ computeLuma (PixelRGBA8 r g b _) =
+ floor $ (0.3 :: Double) * fromIntegral r
+ + 0.59 * fromIntegral g
+ + 0.11 * fromIntegral b
instance LumaPlaneExtractable PixelYCbCr8 where
{-# INLINE computeLuma #-}
@@ -1570,9 +1572,11 @@
instance LumaPlaneExtractable PixelRGB16 where
{-# INLINE computeLuma #-}
- computeLuma (PixelRGB16 r g b) = floor $ 0.3 * toRational r +
- 0.59 * toRational g +
- 0.11 * toRational b
+ computeLuma (PixelRGB16 r g b) =
+ floor $ (0.3 :: Double) * fromIntegral r
+ + 0.59 * fromIntegral g
+ + 0.11 * fromIntegral b
+
--------------------------------------------------
---- PixelRGB8 instances
--------------------------------------------------
@@ -1654,9 +1658,10 @@
instance LumaPlaneExtractable PixelRGB8 where
{-# INLINE computeLuma #-}
- computeLuma (PixelRGB8 r g b) = floor $ 0.3 * toRational r +
- 0.59 * toRational g +
- 0.11 * toRational b
+ computeLuma (PixelRGB8 r g b) =
+ floor $ (0.3 :: Double) * fromIntegral r
+ + 0.59 * fromIntegral g
+ + 0.11 * fromIntegral b
--------------------------------------------------
---- PixelRGBA8 instances
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/JuicyPixels-3.2.6.4/src/Codec/Picture.hs new/JuicyPixels-3.2.7/src/Codec/Picture.hs
--- old/JuicyPixels-3.2.6.4/src/Codec/Picture.hs 2015-12-02 22:38:14.000000000 +0100
+++ new/JuicyPixels-3.2.7/src/Codec/Picture.hs 2016-01-25 23:33:56.000000000 +0100
@@ -1,7 +1,10 @@
{-# LANGUAGE CPP #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TupleSections #-}
+{-# LANGUAGE FlexibleInstances #-}
-- | Main module for image import/export into various image formats.
--
-- To use the library without thinking about it, look after 'decodeImage' and
@@ -23,6 +26,10 @@
, generateFoldImage
, withImage
+ -- * RGB helper functions
+ , convertRGB8
+ , convertRGBA8
+
-- * Lens compatibility
, Traversal
, imagePixels
@@ -138,6 +145,7 @@
import Control.Applicative( (<$>) )
#endif
+import Data.Bits( unsafeShiftR )
import Control.DeepSeq( NFData, deepseq )
import qualified Control.Exception as Exc ( catch, IOException )
import Codec.Picture.Metadata( Metadatas )
@@ -200,6 +208,7 @@
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L
+import qualified Data.Vector.Storable as VS
-- | Return the first Right thing, accumulating error
eitherLoad :: c -> [(String, c -> Either String b)] -> Either String b
@@ -263,6 +272,7 @@
readImageWithMetadata :: FilePath -> IO (Either String (DynamicImage, Metadatas))
readImageWithMetadata = withImageDecoder decodeImageWithMetadata
+
-- | If you want to decode an image in a bytestring without even thinking
-- in term of format or whatever, this is the function to use. It will try
-- to decode in each known format and if one decoding succeeds, it will return
@@ -270,6 +280,85 @@
decodeImage :: B.ByteString -> Either String DynamicImage
decodeImage = fmap fst . decodeImageWithMetadata
+class Decimable px1 px2 where
+ decimateBitDepth :: Image px1 -> Image px2
+
+decimateWord16 :: ( Pixel px1, Pixel px2
+ , PixelBaseComponent px1 ~ Pixel16
+ , PixelBaseComponent px2 ~ Pixel8
+ ) => Image px1 -> Image px2
+decimateWord16 (Image w h da) =
+ Image w h $ VS.map (\v -> fromIntegral $ v `unsafeShiftR` 8) da
+
+decimateFloat :: ( Pixel px1, Pixel px2
+ , PixelBaseComponent px1 ~ PixelF
+ , PixelBaseComponent px2 ~ Pixel8
+ ) => Image px1 -> Image px2
+decimateFloat (Image w h da) =
+ Image w h $ VS.map (floor . (255*) . max 0 . min 1) da
+
+instance Decimable Pixel16 Pixel8 where
+ decimateBitDepth = decimateWord16
+
+instance Decimable PixelYA16 PixelYA8 where
+ decimateBitDepth = decimateWord16
+
+instance Decimable PixelRGB16 PixelRGB8 where
+ decimateBitDepth = decimateWord16
+
+instance Decimable PixelRGBA16 PixelRGBA8 where
+ decimateBitDepth = decimateWord16
+
+instance Decimable PixelCMYK16 PixelCMYK8 where
+ decimateBitDepth = decimateWord16
+
+instance Decimable PixelF Pixel8 where
+ decimateBitDepth = decimateFloat
+
+instance Decimable PixelRGBF PixelRGB8 where
+ decimateBitDepth = decimateFloat
+
+-- | Convert by any mean possible a dynamic image to an image
+-- in RGBA. The process can lose precision while converting from
+-- 16bits pixels or Floating point pixels.
+convertRGBA8 :: DynamicImage -> Image PixelRGBA8
+convertRGBA8 dynImage = case dynImage of
+ ImageY8 img -> promoteImage img
+ ImageY16 img -> promoteImage (decimateBitDepth img :: Image Pixel8)
+ ImageYF img -> promoteImage (decimateBitDepth img :: Image Pixel8)
+ ImageYA8 img -> promoteImage img
+ ImageYA16 img -> promoteImage (decimateBitDepth img :: Image PixelYA8)
+ ImageRGB8 img -> promoteImage img
+ ImageRGB16 img -> promoteImage (decimateBitDepth img :: Image PixelRGB8)
+ ImageRGBF img -> promoteImage (decimateBitDepth img :: Image PixelRGB8)
+ ImageRGBA8 img -> promoteImage img
+ ImageRGBA16 img -> decimateBitDepth img
+ ImageYCbCr8 img -> promoteImage (convertImage img :: Image PixelRGB8)
+ ImageCMYK8 img -> promoteImage (convertImage img :: Image PixelRGB8)
+ ImageCMYK16 img ->
+ promoteImage (convertImage (decimateBitDepth img :: Image PixelCMYK8) :: Image PixelRGB8)
+
+-- | Convert by any mean possible a dynamic image to an image
+-- in RGB. The process can lose precision while converting from
+-- 16bits pixels or Floating point pixels. Any alpha layer will
+-- be dropped
+convertRGB8 :: DynamicImage -> Image PixelRGB8
+convertRGB8 dynImage = case dynImage of
+ ImageY8 img -> promoteImage img
+ ImageY16 img -> promoteImage (decimateBitDepth img :: Image Pixel8)
+ ImageYF img -> promoteImage (decimateBitDepth img :: Image Pixel8)
+ ImageYA8 img -> promoteImage img
+ ImageYA16 img -> promoteImage (decimateBitDepth img :: Image PixelYA8)
+ ImageRGB8 img -> img
+ ImageRGB16 img -> decimateBitDepth img
+ ImageRGBF img -> decimateBitDepth img :: Image PixelRGB8
+ ImageRGBA8 img -> dropAlphaLayer img
+ ImageRGBA16 img -> dropAlphaLayer (decimateBitDepth img :: Image PixelRGBA8)
+ ImageYCbCr8 img -> convertImage img
+ ImageCMYK8 img -> convertImage img
+ ImageCMYK16 img -> convertImage (decimateBitDepth img :: Image PixelCMYK8)
+
+
-- | Equivalent to 'decodeImage', but also provide potential metadatas
-- present in the given file.
decodeImageWithMetadata :: B.ByteString -> Either String (DynamicImage, Metadatas)
@@ -306,7 +395,7 @@
readJpeg :: FilePath -> IO (Either String DynamicImage)
readJpeg = withImageDecoder decodeJpeg
--- | Try to load a .bmp file. The colorspace would be RGB or Y.
+-- | Try to load a .bmp file. The colorspace would be RGB, RGBA or Y.
readBitmap :: FilePath -> IO (Either String DynamicImage)
readBitmap = withImageDecoder decodeBitmap
1
0
Hello community,
here is the log from the commit of package ghc-HUnit for openSUSE:Factory checked in at 2016-01-28 17:23:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-HUnit (Old)
and /work/SRC/openSUSE:Factory/.ghc-HUnit.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-HUnit"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-HUnit/ghc-HUnit.changes 2016-01-22 01:08:35.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-HUnit.new/ghc-HUnit.changes 2016-01-28 17:24:47.000000000 +0100
@@ -1,0 +2,5 @@
+Fri Jan 22 10:12:18 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 1.3.1.1
+
+-------------------------------------------------------------------
Old:
----
HUnit-1.3.1.0.tar.gz
New:
----
HUnit-1.3.1.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-HUnit.spec ++++++
--- /var/tmp/diff_new_pack.1TwUXh/_old 2016-01-28 17:24:47.000000000 +0100
+++ /var/tmp/diff_new_pack.1TwUXh/_new 2016-01-28 17:24:47.000000000 +0100
@@ -19,7 +19,7 @@
%global pkg_name HUnit
Name: ghc-HUnit
-Version: 1.3.1.0
+Version: 1.3.1.1
Release: 0
Summary: A unit testing framework for Haskell
License: BSD-3-Clause
@@ -75,6 +75,6 @@
%files devel -f %{name}-devel.files
%defattr(-,root,root,-)
-%doc examples README.md doc
+%doc examples README.md
%changelog
++++++ HUnit-1.3.1.0.tar.gz -> HUnit-1.3.1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HUnit-1.3.1.0/CHANGELOG.md new/HUnit-1.3.1.1/CHANGELOG.md
--- old/HUnit-1.3.1.0/CHANGELOG.md 1970-01-01 01:00:00.000000000 +0100
+++ new/HUnit-1.3.1.1/CHANGELOG.md 2016-01-19 17:16:50.000000000 +0100
@@ -0,0 +1,19 @@
+## Changes
+
+#### 1.3.1.1
+
+- Various updates to metadata and documentation removing outdated information and making other things more visible
+
+### 1.3.1.0
+
+- add minimal support for GHC 8.0
+
+### 1.3.0.0
+
+- removed support for old compilers
+
+- add source locations for failing assertions (GHC >= 7.10.2 only)
+
+#### 1.2.5.2
+
+- Added support for GHC 7.7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HUnit-1.3.1.0/HUnit.cabal new/HUnit-1.3.1.1/HUnit.cabal
--- old/HUnit-1.3.1.0/HUnit.cabal 2016-01-11 10:04:20.000000000 +0100
+++ new/HUnit-1.3.1.1/HUnit.cabal 2016-01-19 17:16:50.000000000 +0100
@@ -1,23 +1,22 @@
Name: HUnit
-Version: 1.3.1.0
+Version: 1.3.1.1
Cabal-Version: >= 1.8
License: BSD3
License-File: LICENSE
Author: Dean Herington
Maintainer: Simon Hengel <sol(a)typeful.net>
Stability: stable
-Homepage: http://hunit.sourceforge.net/
+Homepage: https://github.com/hspec/HUnit#readme
Category: Testing
Synopsis: A unit testing framework for Haskell
Description:
HUnit is a unit testing framework for Haskell, inspired by the
JUnit tool for Java, see: <http://www.junit.org>.
Build-Type: Simple
-Data-Files:
- doc/Guide.html
- examples/Example.hs
- prologue.txt
+Extra-Source-Files:
+ CHANGELOG.md
README.md
+ examples/Example.hs
source-repository head
type: git
@@ -38,7 +37,7 @@
Test-Suite tests
Type: exitcode-stdio-1.0
Main-Is: HUnitTests.hs
- HS-Source-Dirs: tests
+ HS-Source-Dirs: tests, examples
Build-Depends:
base == 4.*,
deepseq,
@@ -49,4 +48,5 @@
HUnitTestBase
HUnitTestExtended
TerminalTest
+ Example
GHC-Options: -Wall
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HUnit-1.3.1.0/README.md new/HUnit-1.3.1.1/README.md
--- old/HUnit-1.3.1.0/README.md 2016-01-11 10:04:20.000000000 +0100
+++ new/HUnit-1.3.1.1/README.md 2016-01-19 17:16:50.000000000 +0100
@@ -1,28 +1,545 @@
-# HUnit
+# HUnit User's Guide
-HUnit is a unit testing framework for Haskell, inspired by the JUnit
-tool for Java. HUnit is free software; see its "License" file for
-details. HUnit is available at <http://hunit.sourceforge.net>.
+HUnit is a unit testing framework for Haskell, inspired by the JUnit tool for Java. This
+guide describes how to use HUnit, assuming you are familiar with Haskell, though not
+necessarily with JUnit. You can obtain HUnit, including this guide, at
+[https://github.com/hspec/HUnit](https://github.com/hspec/HUnit)
-HUnit 1.1.1 consists of a number of files. Besides Haskell source files
-in Test/HUnit (whose names end in ".hs" or ".lhs"), these files include:
+## Introduction
+A test-centered methodology for software development is most effective when tests are
+easy to create, change, and execute. The [JUnit](www.junit.org) tool
+pioneered support for test-first development in [Java](http://java.sun.com).
+HUnit is an adaptation of JUnit to Haskell, a general-purpose, purely functional
+programming language. (To learn more about Haskell, see www.haskell.org](http://www.haskell.org).
+With HUnit, as with JUnit, you can easily create tests, name them, group them into
+suites, and execute them, with the framework checking the results automatically. Test
+specification in HUnit is even more concise and flexible than in JUnit, thanks to the
+nature of the Haskell language. HUnit currently includes only a text-based test
+controller, but the framework is designed for easy extension. (Would anyone care to
+write a graphical test controller for HUnit?)
+
+The next section helps you get started using HUnit in simple ways. Subsequent sections
+give details on [writing tests](#writing-tests) and [running tests](#running-tests).
+The document concludes with a section describing HUnit's [constituent files](#constituent-files)
+and a section giving [references](#references) to further information.
+
+## Getting Started
+
+In the Haskell module where your tests will reside, import module `Test.HUnit`:
+
+```haskell
+import Test.HUnit
+```
+
+Define test cases as appropriate:
+
+```haskell
+test1 = TestCase (assertEqual "for (foo 3)," (1,2) (foo 3))
+test2 = TestCase (do (x,y) <- partA 3
+ assertEqual "for the first result of partA," 5 x
+ b <- partB y
+ assertBool ("(partB " ++ show y ++ ") failed") b)
+```
+
+Name the test cases and group them together:
+
+```haskell
+tests = TestList [TestLabel "test1" test1, TestLabel "test2" test2]
+```
+
+Run the tests as a group. At a Haskell interpreter prompt, apply the
+function `runTestTT` to the collected tests. (The `TT` suggests
+**T**ext orientation with output to the **T**erminal.)
+
+```haskell
+> runTestTT tests
+Cases: 2 Tried: 2 Errors: 0 Failures: 0
+>
+```
+
+If the tests are proving their worth, you might see:
+
+```haskell
+> runTestTT tests
+### Failure in: 0:test1
+for (foo 3),
+expected: (1,2)
+ but got: (1,3)
+Cases: 2 Tried: 2 Errors: 0 Failures: 1
+>
+```
+
+Isn't that easy?
+
+You can specify tests even more succinctly using operators and
+overloaded functions that HUnit provides:
+
+```haskell
+tests = test [ "test1" ~: "(foo 3)" ~: (1,2) ~=? (foo 3),
+ "test2" ~: do (x, y) <- partA 3
+ assertEqual "for the first result of partA," 5 x
+ partB y @? "(partB " ++ show y ++ ") failed" ]
+```
+
+Assuming the same test failures as before, you would see:
+
+```haskell
+> runTestTT tests
+### Failure in: 0:test1:(foo 3)
+expected: (1,2)
+ but got: (1,3)
+Cases: 2 Tried: 2 Errors: 0 Failures: 1
+>
+```
+
+## Writing Tests
+
+Tests are specified compositionally. [Assertions](#assertions) are
+combined to make a [test case](#test-case), and test cases are combined
+into [tests](#tests). HUnit also provides [advanced
+features](#advanced-features) for more convenient test specification.
+
+### Assertions
+
+ The basic building block of a test is an **assertion**.
+
+```haskell
+type Assertion = IO ()
+```
+
+An assertion is an `IO` computation that always produces a void result. Why is an assertion an `IO` computation? So that programs with real-world side effects can be tested. How does an assertion assert anything if it produces no useful result? The answer is that an assertion can signal failure by calling `assertFailure`.
+
+```haskell
+assertFailure :: String -> Assertion
+assertFailure msg = ioError (userError ("HUnit:" ++ msg))
+```
+
+`(assertFailure msg)` raises an exception. The string argument identifies the
+ failure. The failure message is prefixed by "`HUnit:`" to mark it as an HUnit
+ assertion failure message. The HUnit test framework interprets such an exception as
+ indicating failure of the test whose execution raised the exception. (Note: The details
+ concerning the implementation of `assertFailure` are subject to change and should
+ not be relied upon.)
+
+`assertFailure` can be used directly, but it is much more common to use it
+ indirectly through other assertion functions that conditionally assert failure.
+
+```haskell
+assertBool :: String -> Bool -> Assertion
+assertBool msg b = unless b (assertFailure msg)
+
+assertString :: String -> Assertion
+assertString s = unless (null s) (assertFailure s)
+
+assertEqual :: (Eq a, Show a) => String -> a -> a -> Assertion
+assertEqual preface expected actual =
+ unless (actual == expected) (assertFailure msg)
+ where msg = (if null preface then "" else preface ++ "\n") ++
+ "expected: " ++ show expected ++ "\n but got: " ++ show actual
+```
+
+With `assertBool` you give the assertion condition and failure message separately.
+ With `assertString` the two are combined. With `assertEqual` you provide a
+ "preface", an expected value, and an actual value; the failure message shows the two
+ unequal values and is prefixed by the preface. Additional ways to create assertions are
+ described later under [Avanced Features](#advanced-features)
+
+Since assertions are `IO` computations, they may be combined--along with other
+ `IO` computations--using `(>>=)`, `(>>)`, and the `do`
+ notation. As long as its result is of type `(IO ())`, such a combination
+ constitutes a single, collective assertion, incorporating any number of constituent
+ assertions. The important features of such a collective assertion are that it fails if
+ any of its constituent assertions is executed and fails, and that the first constituent
+ assertion to fail terminates execution of the collective assertion. Such behavior is
+ essential to specifying a test case.
+
+### Test Case
+
+A **test case** is the unit of test execution. That is, distinct test cases are
+ executed independently. The failure of one is independent of the failure of any other.
+
+A test case consists of a single, possibly collective, assertion. The possibly multiple
+ constituent assertions in a test case's collective assertion are **not** independent.
+ Their interdependence may be crucial to specifying correct operation for a test. A test
+ case may involve a series of steps, each concluding in an assertion, where each step
+ must succeed in order for the test case to continue. As another example, a test may
+ require some "set up" to be performed that must be undone ("torn down" in JUnit
+ parlance) once the test is complete. In this case, you could use Haskell's
+ `IO.bracket` function to achieve the desired effect.
+
+You can make a test case from an assertion by applying the `TestCase` constructor.
+ For example, `(TestCase (return ()))` is a test case that never
+ fails, and `(TestCase (assertEqual "for x," 3 x))`
+ is a test case that checks that the value of `x` is 3. Additional ways
+ to create test cases are described later under [Advanced Features](#advanced-eatures).
+
+### Tests
+
+As soon as you have more than one test, you'll want to name them to tell them apart. As
+ soon as you have more than several tests, you'll want to group them to process them more
+ easily. So, naming and grouping are the two keys to managing collections of tests.
+
+In tune with the "composite" design pattern [1], a
+ **test** is defined as a package of test cases. Concretely, a test is either a single
+ test case, a group of tests, or either of the first two identified by a label.
+
+```haskell
+data Test = TestCase Assertion
+ | TestList [Test]
+ | TestLabel String Test
+```
+
+There are three important features of this definition to note:
+
+
+* A `TestList` consists of a list of tests rather than a list of test cases.
+ This means that the structure of a `Test` is actually a tree. Using a
+ hierarchy helps organize tests just as it helps organize files in a file system.
+* A `TestLabel` is attached to a test rather than to a test case. This means
+ that all nodes in the test tree, not just test case (leaf) nodes, can be labeled.
+ Hierarchical naming helps organize tests just as it helps organize files in a file
+ system.
+* A `TestLabel` is separate from both `TestCase` and `TestList`.
+ This means that labeling is optional everywhere in the tree. Why is this a good
+ thing? Because of the hierarchical structure of a test, each constituent test case
+ is uniquely identified by its path in the tree, ignoring all labels. Sometimes a
+ test case's path (or perhaps its subpath below a certain node) is a perfectly
+ adequate "name" for the test case (perhaps relative to a certain node). In this
+ case, creating a label for the test case is both unnecessary and inconvenient.
+
+
+The number of test cases that a test comprises can be computed with `testCaseCount`.
+
+```haskell
+testCaseCount :: Test -> Int
+```
+
+As mentioned above, a test is identified by its **path** in the test hierarchy.
+
+```haskell
+data Node = ListItem Int | Label String
+ deriving (Eq, Show, Read)
+
+type Path = [Node] -- Node order is from test case to root.
+```
+
+Each occurrence of `TestList` gives rise to a `ListItem` and each
+ occurrence of `TestLabel` gives rise to a `Label`. The `ListItem`s
+ by themselves ensure uniqueness among test case paths, while the `Label`s allow
+ you to add mnemonic names for individual test cases and collections of them.
+
+Note that the order of nodes in a path is reversed from what you might expect: The first
+ node in the list is the one deepest in the tree. This order is a concession to
+ efficiency: It allows common path prefixes to be shared.
+
+The paths of the test cases that a test comprises can be computed with
+ `testCasePaths`. The paths are listed in the order in which the corresponding
+ test cases would be executed.
+
+```haskell
+testCasePaths :: Test -> [Path]
+```
+
+The three variants of `Test` can be constructed simply by applying
+ `TestCase`, `TestList`, and `TestLabel` to appropriate arguments.
+ Additional ways to create tests are described later under [Advanced Features](#advanced-features).
+
+The design of the type `Test` provides great conciseness, flexibility, and
+ convenience in specifying tests. Moreover, the nature of Haskell significantly augments
+ these qualities:
+
+* Combining assertions and other code to construct test cases is easy with the
+ `IO` monad.
+* Using overloaded functions and special operators (see below), specification of
+ assertions and tests is extremely compact.
+* Structuring a test tree by value, rather than by name as in JUnit, provides for more
+ convenient, flexible, and robust test suite specification. In particular, a test
+ suite can more easily be computed "on the fly" than in other test frameworks.
+* Haskell's powerful abstraction facilities provide unmatched support for test
+ refactoring.
+
+### Advanced Features
+
+HUnit provides additional features for specifying assertions and tests more conveniently
+ and concisely. These facilities make use of Haskell type classes.
+
+The following operators can be used to construct assertions.
+
+```haskell
+infix 1 @?, @=?, @?=
+
+(@?) :: (AssertionPredicable t) => t -> String -> Assertion
+pred @? msg = assertionPredicate pred >>= assertBool msg
+
+(@=?) :: (Eq a, Show a) => a -> a -> Assertion
+expected @=? actual = assertEqual "" expected actual
+
+(@?=) :: (Eq a, Show a) => a -> a -> Assertion
+actual @?= expected = assertEqual "" expected actual
+```
+
+You provide a boolean condition and failure message separately to `(@?)`, as for
+ `assertBool`, but in a different order. The `(@=?)` and `(@?=)`
+ operators provide shorthands for `assertEqual` when no preface is required. They
+ differ only in the order in which the expected and actual values are provided. (The
+ actual value--the uncertain one--goes on the "?" side of the operator.)
+
+The `(@?)` operator's first argument is something from which an assertion
+ predicate can be made, that is, its type must be `AssertionPredicable`.
+
+```haskell
+type AssertionPredicate = IO Bool
+
+class AssertionPredicable t
+ where assertionPredicate :: t -> AssertionPredicate
+
+instance AssertionPredicable Bool
+ where assertionPredicate = return
+
+instance (AssertionPredicable t) => AssertionPredicable (IO t)
+ where assertionPredicate = (>>= assertionPredicate)
+```
+
+The overloaded `assert` function in the `Assertable` type class constructs
+ an assertion.
+
+```haskell
+class Assertable t
+ where assert :: t -> Assertion
+
+instance Assertable ()
+ where assert = return
+
+instance Assertable Bool
+ where assert = assertBool ""
+
+instance (ListAssertable t) => Assertable [t]
+ where assert = listAssert
+
+instance (Assertable t) => Assertable (IO t)
+ where assert = (>>= assert)
+```
+
+The `ListAssertable` class allows `assert` to be applied to `[Char]`
+ (that is, `String`).
+
+```haskell
+class ListAssertable t
+ where listAssert :: [t] -> Assertion
+
+instance ListAssertable Char
+ where listAssert = assertString
+```
+
+With the above declarations, `(assert ())`,
+ `(assert True)`, and `(assert "")` (as well as
+ `IO` forms of these values, such as `(return ())`) are all
+ assertions that never fail, while `(assert False)` and
+ `(assert "some failure message")` (and their
+ `IO` forms) are assertions that always fail. You may define additional
+ instances for the type classes `Assertable`, `ListAssertable`, and
+ `AssertionPredicable` if that should be useful in your application.
+
+The overloaded `test` function in the `Testable` type class constructs a
+ test.
+
+```haskell
+class Testable t
+ where test :: t -> Test
+
+instance Testable Test
+ where test = id
+
+instance (Assertable t) => Testable (IO t)
+ where test = TestCase . assert
+
+instance (Testable t) => Testable [t]
+ where test = TestList . map test
+```
+
+The `test` function makes a test from either an `Assertion` (using
+ `TestCase`), a list of `Testable` items (using `TestList`), or
+ a `Test` (making no change).
+
+The following operators can be used to construct tests.
+
+```haskell
+infix 1 ~?, ~=?, ~?=
+infixr 0 ~:
+
+(~?) :: (AssertionPredicable t) => t -> String -> Test
+pred ~? msg = TestCase (pred @? msg)
+
+(~=?) :: (Eq a, Show a) => a -> a -> Test
+expected ~=? actual = TestCase (expected @=? actual)
+
+(~?=) :: (Eq a, Show a) => a -> a -> Test
+actual ~?= expected = TestCase (actual @?= expected)
+
+(~:) :: (Testable t) => String -> t -> Test
+label ~: t = TestLabel label (test t)
+```
+
+`(~?)`, `(~=?)`, and `(~?=)` each make an assertion, as for
+ `(@?)`, `(@=?)`, and `(@?=)`, respectively, and then a test case
+ from that assertion. `(~:)` attaches a label to something that is
+ `Testable`. You may define additional instances for the type class
+ `Testable` should that be useful.
+
+## Running Tests
+
+HUnit is structured to support multiple test controllers. The first
+ subsection below describes the [test execution](#test-execution)
+ characteristics common to all test controllers. The second subsection
+ describes the text-based controller that is included with HUnit.
+
+## Test Execution
+
+All test controllers share a common test execution model. They differ only in how the
+ results of test execution are shown.
+
+The execution of a test (a value of type `Test`) involves the serial execution (in
+ the `IO` monad) of its constituent test cases. The test cases are executed in a
+ depth-first, left-to-right order. During test execution, four counts of test cases are
+ maintained:
+
+```haskell
+data Counts = Counts { cases, tried, errors, failures :: Int }
+ deriving (Eq, Show, Read)
```
- * README.md -- this file
- * doc/Guide.html -- user's guide, in HTML format
- * LICENSE -- license for use of HUnit
+
+
+* `cases` is the number of test cases included in the test. This number is a
+ static property of a test and remains unchanged during test execution.
+* `tried` is the number of test cases that have been executed so far during the
+ test execution.
+* `errors` is the number of test cases whose execution ended with an unexpected
+ exception being raised. Errors indicate problems with test cases, as opposed to the
+ code under test.
+* `failures` is the number of test cases whose execution asserted failure.
+ Failures indicate problems with the code under test.
+
+
+Why is there no count for test case successes? The technical reason is that the counts
+ are maintained such that the number of test case successes is always equal to
+ `(tried - (errors + failures))`. The
+ psychosocial reason is that, with test-centered development and the expectation that
+ test failures will be few and short-lived, attention should be focused on the failures
+ rather than the successes.
+
+As test execution proceeds, three kinds of reporting event are communicated to the test
+ controller. (What the controller does in response to the reporting events depends on the
+ controller.)
+
+* *start* -- Just prior to initiation of a test case, the path of the test case
+ and the current counts (excluding the current test case) are reported.
+* *error* -- When a test case terminates with an error, the error message is
+ reported, along with the test case path and current counts (including the current
+ test case).
+* *failure* -- When a test case terminates with a failure, the failure message is
+ reported, along with the test case path and current counts (including the current
+ test case).
+
+Typically, a test controller shows *error* and *failure* reports immediately
+ but uses the *start* report merely to update an indication of overall test
+ execution progress.
+
+### Text-Based Controller
+
+A text-based test controller is included with HUnit.
+
+```haskell
+runTestText :: PutText st -> Test -> IO (Counts, st)
+```
+
+`runTestText` is generalized on a *reporting scheme* given as its first
+ argument. During execution of the test given as its second argument, the controller
+ creates a string for each reporting event and processes it according to the reporting
+ scheme. When test execution is complete, the controller returns the final counts along
+ with the final state for the reporting scheme.
+
+The strings for the three kinds of reporting event are as follows.
+
+* A *start* report is the result of the function `showCounts` applied to
+ the counts current immediately prior to initiation of the test case being started.
+* An *error* report is of the form
+ "`Error in: *path*\n*message*`",
+ where *path* is the path of the test case in error, as shown by
+ `showPath`, and *message* is a message describing the error. If the path
+ is empty, the report has the form "`Error:\n*message*`".
+* A *failure* report is of the form
+ "`Failure in: *path*\n*message*`", where
+ *path* is the path of the test case in error, as shown by
+ `showPath`, and *message* is the failure message. If the path is empty,
+ the report has the form "`Failure:\n*message*`".
+
+The function `showCounts` shows a set of counts.
+
+```haskell
+showCounts :: Counts -> String
+```
+
+The form of its result is
+`Cases: *cases* Tried: *tried* Errors: *errors* Failures: *failures*`
+where *cases*, *tried*, *errors*, and *failures* are the count values.
+
+The function `showPath` shows a test case path.
+
+```haskell
+ showPath :: Path -> String
+```
+
+The nodes in the path are reversed (so that the path reads from the root down to the test
+ case), and the representations for the nodes are joined by '`:`' separators. The
+ representation for `(ListItem *n*)` is `(show n)`. The representation
+ for `(Label *label*)` is normally *label*. However, if *label*
+ contains a colon or if `(show *label*)` is different from *label*
+ surrounded by quotation marks--that is, if any ambiguity could exist--then `(Label
+ *label*)` is represented as `(show *label*)`.
+
+HUnit includes two reporting schemes for the text-based test controller. You may define
+ others if you wish.
+
+```haskell
+putTextToHandle :: Handle -> Bool -> PutText Int
+```
+
+`putTextToHandle` writes error and failure reports, plus a report of the final
+ counts, to the given handle. Each of these reports is terminated by a newline. In
+ addition, if the given flag is `True`, it writes start reports to the handle as
+ well. A start report, however, is not terminated by a newline. Before the next report is
+ written, the start report is "erased" with an appropriate sequence of carriage return
+ and space characters. Such overwriting realizes its intended effect on terminal devices.
+
+```haskell
+putTextToShowS :: PutText ShowS
+```
+
+`putTextToShowS` ignores start reports and simply accumulates error and failure
+ reports, terminating them with newlines. The accumulated reports are returned (as the
+ second element of the pair returned by `runTestText`) as a `ShowS`
+ function (that is, one with type `(String -> String)`) whose
+ first argument is a string to be appended to the accumulated report lines.
+
+HUnit provides a shorthand for the most common use of the text-based test controller.
+
+```haskell
+runTestTT :: Test -> IO Counts
```
-See the user's guide for more information.
+`runTestTT` invokes `runTestText`, specifying `(putTextToHandle stderr
+True)` for the reporting scheme, and returns the final counts from the
+test execution.
-## Changes
+## References
-### 1.3.1.0
+* [1] Gamma, E., et al. Design Patterns: Elements of Reusable Object-Oriented Software, Addison-Wesley, Reading, MA, 1995: The classic book describing design patterns in an object-oriented context.
-- add minimal support for GHC 8.0
+* [junit.org](http://www.junit.org): Web page for JUnit, the tool after which HUnit is modeled.
-### 1.3.0.0
+* [http://junit.sourceforge.net/doc/testinfected/testing.htm](http://junit.sou…: A good introduction to test-first development and the use of JUnit.
-- removed support for old compilers
+* [http://junit.sourceforge.net/doc/cookstour/cookstour.htm](http://junit.sour…: A description of the internal structure of JUnit. Makes for an interesting comparison between JUnit and HUnit.
-- add source locations for failing assertions (GHC >= 7.10.2 only)
+The HUnit software and this guide were written by Dean Herington [heringto@cs.unc.edu](mailto:heringto@cs.unc.edu)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HUnit-1.3.1.0/doc/Guide.html new/HUnit-1.3.1.1/doc/Guide.html
--- old/HUnit-1.3.1.0/doc/Guide.html 2016-01-11 10:04:20.000000000 +0100
+++ new/HUnit-1.3.1.1/doc/Guide.html 1970-01-01 01:00:00.000000000 +0100
@@ -1,539 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd" xml:lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <meta name="Author" content="Dean Herington"/>
- <meta name="KeyWords" content="HUnit, unit testing, test-first development, Haskell, JUnit"/>
- <title>HUnit 1.0 User's Guide</title>
- </head>
- <body>
-
- <h1>HUnit 1.2 User's Guide</h1>
-
- <p>HUnit is a unit testing framework for Haskell, inspired by the JUnit tool for Java. This
- guide describes how to use HUnit, assuming you are familiar with Haskell, though not
- necessarily with JUnit. You can obtain HUnit, including this guide, at <a
- href="http://code.haskell.org/HUnit">http://code.haskell.org/HUnit</a>.</p>
-
- <h2>Introduction</h2>
-
- <p>A test-centered methodology for software development is most effective when tests are
- easy to create, change, and execute. The <a href="http://www.junit.org">JUnit</a> tool
- pioneered support for test-first development in <a href="http://java.sun.com">Java</a>.
- HUnit is an adaptation of JUnit to Haskell, a general-purpose, purely functional
- programming language. (To learn more about Haskell, see <a href="http://www.haskell.org"
- >http://www.haskell.org</a>.)</p>
-
- <p>With HUnit, as with JUnit, you can easily create tests, name them, group them into
- suites, and execute them, with the framework checking the results automatically. Test
- specification in HUnit is even more concise and flexible than in JUnit, thanks to the
- nature of the Haskell language. HUnit currently includes only a text-based test
- controller, but the framework is designed for easy extension. (Would anyone care to
- write a graphical test controller for HUnit?)</p>
-
- <p>The next section helps you get started using HUnit in simple ways. Subsequent sections
- give details on <a href="#WritingTests">writing tests</a> and <a href="#RunningTests"
- >running tests</a>. The document concludes with a section describing HUnit's <a
- href="#ConstituentFiles">constituent files</a> and a section giving <a
- href="#References">references</a> to further information.</p>
-
- <h2 id="GettingStarted">Getting Started</h2>
-
- <p>In the Haskell module where your tests will reside, import module <tt>Test.HUnit</tt>:</p>
- <pre>
- import Test.HUnit
-</pre>
- <p>Define test cases as appropriate:</p>
- <pre>
- test1 = TestCase (assertEqual "for (foo 3)," (1,2) (foo 3))
- test2 = TestCase (do (x,y) <- partA 3
- assertEqual "for the first result of partA," 5 x
- b <- partB y
- assertBool ("(partB " ++ show y ++ ") failed") b)
-</pre>
- <p>Name the test cases and group them together:</p>
- <pre>
- tests = TestList [TestLabel "test1" test1, TestLabel "test2" test2]
-</pre>
- <p>Run the tests as a group. At a Haskell interpreter prompt, apply the function
- <tt>runTestTT</tt> to the collected tests. (The "<tt>TT</tt>" suggests
- <strong>T</strong>ext orientation with output to the <strong>T</strong>erminal.)</p>
- <pre>
- > runTestTT tests
- Cases: 2 Tried: 2 Errors: 0 Failures: 0
- >
-</pre>
- <p>If the tests are proving their worth, you might see:</p>
- <pre>
- > runTestTT tests
- ### Failure in: 0:test1
- for (foo 3),
- expected: (1,2)
- but got: (1,3)
- Cases: 2 Tried: 2 Errors: 0 Failures: 1
- >
-</pre>
- <p>Isn't that easy?</p>
-
- <p>You can specify tests even more succinctly using operators and overloaded functions that
- HUnit provides:</p>
- <pre>
- tests = test [ "test1" ~: "(foo 3)" ~: (1,2) ~=? (foo 3),
- "test2" ~: do (x, y) <- partA 3
- assertEqual "for the first result of partA," 5 x
- partB y @? "(partB " ++ show y ++ ") failed" ]
-</pre>
- <p>Assuming the same test failures as before, you would see:</p>
- <pre>
- > runTestTT tests
- ### Failure in: 0:test1:(foo 3)
- expected: (1,2)
- but got: (1,3)
- Cases: 2 Tried: 2 Errors: 0 Failures: 1
- >
-</pre>
-
- <h2 id="WritingTests">Writing Tests</h2>
-
- <p>Tests are specified compositionally. <a href="#Assertions">Assertions</a> are combined to
- make a <a href="#TestCase">test case</a>, and test cases are combined into <a
- href="#Tests">tests</a>. HUnit also provides <a href="#AdvancedFeatures">advanced
- features</a> for more convenient test specification.</p>
-
- <h3 id="Assertions">Assertions</h3>
-
- <p>The basic building block of a test is an <b>assertion</b>.</p>
- <pre>
- type Assertion = IO ()
-</pre>
- <p>An assertion is an <tt>IO</tt> computation that always produces a void result. Why is an
- assertion an <tt>IO</tt> computation? So that programs with real-world side effects can
- be tested. How does an assertion assert anything if it produces no useful result? The
- answer is that an assertion can signal failure by calling <tt>assertFailure</tt>.</p>
- <pre>
- assertFailure :: String -> Assertion
- assertFailure msg = ioError (userError ("HUnit:" ++ msg))
-</pre>
- <p><tt>(assertFailure msg)</tt> raises an exception. The string argument identifies the
- failure. The failure message is prefixed by "<tt>HUnit:</tt>" to mark it as an HUnit
- assertion failure message. The HUnit test framework interprets such an exception as
- indicating failure of the test whose execution raised the exception. (Note: The details
- concerning the implementation of <tt>assertFailure</tt> are subject to change and should
- not be relied upon.)</p>
-
- <p><tt>assertFailure</tt> can be used directly, but it is much more common to use it
- indirectly through other assertion functions that conditionally assert failure.</p>
- <pre>
- assertBool :: String -> Bool -> Assertion
- assertBool msg b = unless b (assertFailure msg)
-
- assertString :: String -> Assertion
- assertString s = unless (null s) (assertFailure s)
-
- assertEqual :: (Eq a, Show a) => String -> a -> a -> Assertion
- assertEqual preface expected actual =
- unless (actual == expected) (assertFailure msg)
- where msg = (if null preface then "" else preface ++ "\n") ++
- "expected: " ++ show expected ++ "\n but got: " ++ show actual
-</pre>
- <p>With <tt>assertBool</tt> you give the assertion condition and failure message separately.
- With <tt>assertString</tt> the two are combined. With <tt>assertEqual</tt> you provide a
- "preface", an expected value, and an actual value; the failure message shows the two
- unequal values and is prefixed by the preface. Additional ways to create assertions are
- described later under <a href="#AdvancedFeatures">Advanced Features</a>.</p>
-
- <p>Since assertions are <tt>IO</tt> computations, they may be combined--along with other
- <tt>IO</tt> computations--using <tt>(>>=)</tt>, <tt>(>>)</tt>, and the <tt>do</tt>
- notation. As long as its result is of type <tt>(IO ())</tt>, such a combination
- constitutes a single, collective assertion, incorporating any number of constituent
- assertions. The important features of such a collective assertion are that it fails if
- any of its constituent assertions is executed and fails, and that the first constituent
- assertion to fail terminates execution of the collective assertion. Such behavior is
- essential to specifying a test case.</p>
-
- <h3 id="TestCase">Test Case</h3>
-
- <p>A <b>test case</b> is the unit of test execution. That is, distinct test cases are
- executed independently. The failure of one is independent of the failure of any other.</p>
-
- <p>A test case consists of a single, possibly collective, assertion. The possibly multiple
- constituent assertions in a test case's collective assertion are <b>not</b> independent.
- Their interdependence may be crucial to specifying correct operation for a test. A test
- case may involve a series of steps, each concluding in an assertion, where each step
- must succeed in order for the test case to continue. As another example, a test may
- require some "set up" to be performed that must be undone ("torn down" in JUnit
- parlance) once the test is complete. In this case, you could use Haskell's
- <tt>IO.bracket</tt> function to achieve the desired effect.</p>
-
- <p>You can make a test case from an assertion by applying the <tt>TestCase</tt> constructor.
- For example, <tt>(TestCase (return ()))</tt> is a test case that never
- fails, and
- <tt>(TestCase (assertEqual "for x," 3 x))</tt>
- is a test case that checks that the value of <tt>x</tt> is 3. Additional ways
- to create test cases are described later under <a href="#AdvancedFeatures">Advanced
- Features</a>.</p>
-
- <h3 id="Tests">Tests</h3>
-
- <p>As soon as you have more than one test, you'll want to name them to tell them apart. As
- soon as you have more than several tests, you'll want to group them to process them more
- easily. So, naming and grouping are the two keys to managing collections of tests.</p>
-
- <p>In tune with the "composite" design pattern [<a href="#DesignPatterns">1</a>], a
- <b>test</b> is defined as a package of test cases. Concretely, a test is either a single
- test case, a group of tests, or either of the first two identified by a label.</p>
- <pre>
- data Test = TestCase Assertion
- | TestList [Test]
- | TestLabel String Test
-</pre>
- <p>There are three important features of this definition to note:</p>
- <ul>
- <li>A <tt>TestList</tt> consists of a list of tests rather than a list of test cases.
- This means that the structure of a <tt>Test</tt> is actually a tree. Using a
- hierarchy helps organize tests just as it helps organize files in a file system.</li>
- <li>A <tt>TestLabel</tt> is attached to a test rather than to a test case. This means
- that all nodes in the test tree, not just test case (leaf) nodes, can be labeled.
- Hierarchical naming helps organize tests just as it helps organize files in a file
- system.</li>
- <li>A <tt>TestLabel</tt> is separate from both <tt>TestCase</tt> and <tt>TestList</tt>.
- This means that labeling is optional everywhere in the tree. Why is this a good
- thing? Because of the hierarchical structure of a test, each constituent test case
- is uniquely identified by its path in the tree, ignoring all labels. Sometimes a
- test case's path (or perhaps its subpath below a certain node) is a perfectly
- adequate "name" for the test case (perhaps relative to a certain node). In this
- case, creating a label for the test case is both unnecessary and inconvenient.</li>
- </ul>
- <p>The number of test cases that a test comprises can be computed with
- <tt>testCaseCount</tt>.</p>
- <pre>
- testCaseCount :: Test -> Int
-</pre>
- <p>As mentioned above, a test is identified by its <b>path</b> in the test hierarchy.</p>
- <pre>
- data Node = ListItem Int | Label String
- deriving (Eq, Show, Read)
-
- type Path = [Node] -- Node order is from test case to root.
-</pre>
- <p>Each occurrence of <tt>TestList</tt> gives rise to a <tt>ListItem</tt> and each
- occurrence of <tt>TestLabel</tt> gives rise to a <tt>Label</tt>. The <tt>ListItem</tt>s
- by themselves ensure uniqueness among test case paths, while the <tt>Label</tt>s allow
- you to add mnemonic names for individual test cases and collections of them.</p>
-
- <p>Note that the order of nodes in a path is reversed from what you might expect: The first
- node in the list is the one deepest in the tree. This order is a concession to
- efficiency: It allows common path prefixes to be shared.</p>
-
- <p>The paths of the test cases that a test comprises can be computed with
- <tt>testCasePaths</tt>. The paths are listed in the order in which the corresponding
- test cases would be executed.</p>
- <pre>
- testCasePaths :: Test -> [Path]
-</pre>
-
- <p>The three variants of <tt>Test</tt> can be constructed simply by applying
- <tt>TestCase</tt>, <tt>TestList</tt>, and <tt>TestLabel</tt> to appropriate arguments.
- Additional ways to create tests are described later under <a href="#AdvancedFeatures"
- >Advanced Features</a>.</p>
-
- <p>The design of the type <tt>Test</tt> provides great conciseness, flexibility, and
- convenience in specifying tests. Moreover, the nature of Haskell significantly augments
- these qualities:</p>
- <ul>
- <li>Combining assertions and other code to construct test cases is easy with the
- <tt>IO</tt> monad.</li>
- <li>Using overloaded functions and special operators (see below), specification of
- assertions and tests is extremely compact.</li>
- <li>Structuring a test tree by value, rather than by name as in JUnit, provides for more
- convenient, flexible, and robust test suite specification. In particular, a test
- suite can more easily be computed "on the fly" than in other test frameworks.</li>
- <li>Haskell's powerful abstraction facilities provide unmatched support for test
- refactoring.</li>
- </ul>
-
- <h3 id="AdvancedFeatures">Advanced Features</h3>
-
- <p>HUnit provides additional features for specifying assertions and tests more conveniently
- and concisely. These facilities make use of Haskell type classes.</p>
-
- <p>The following operators can be used to construct assertions.</p>
- <pre>
- infix 1 @?, @=?, @?=
-
- (@?) :: (AssertionPredicable t) => t -> String -> Assertion
- pred @? msg = assertionPredicate pred >>= assertBool msg
-
- (@=?) :: (Eq a, Show a) => a -> a -> Assertion
- expected @=? actual = assertEqual "" expected actual
-
- (@?=) :: (Eq a, Show a) => a -> a -> Assertion
- actual @?= expected = assertEqual "" expected actual
-</pre>
- <p>You provide a boolean condition and failure message separately to <tt>(@?)</tt>, as for
- <tt>assertBool</tt>, but in a different order. The <tt>(@=?)</tt> and <tt>(@?=)</tt>
- operators provide shorthands for <tt>assertEqual</tt> when no preface is required. They
- differ only in the order in which the expected and actual values are provided. (The
- actual value--the uncertain one--goes on the "?" side of the operator.)</p>
-
- <p>The <tt>(@?)</tt> operator's first argument is something from which an assertion
- predicate can be made, that is, its type must be <tt>AssertionPredicable</tt>.</p>
- <pre>
- type AssertionPredicate = IO Bool
-
- class AssertionPredicable t
- where assertionPredicate :: t -> AssertionPredicate
-
- instance AssertionPredicable Bool
- where assertionPredicate = return
-
- instance (AssertionPredicable t) => AssertionPredicable (IO t)
- where assertionPredicate = (>>= assertionPredicate)
-</pre>
- <p>The overloaded <tt>assert</tt> function in the <tt>Assertable</tt> type class constructs
- an assertion.</p>
- <pre>
- class Assertable t
- where assert :: t -> Assertion
-
- instance Assertable ()
- where assert = return
-
- instance Assertable Bool
- where assert = assertBool ""
-
- instance (ListAssertable t) => Assertable [t]
- where assert = listAssert
-
- instance (Assertable t) => Assertable (IO t)
- where assert = (>>= assert)
-</pre>
- <p>The <tt>ListAssertable</tt> class allows <tt>assert</tt> to be applied to <tt>[Char]</tt>
- (that is, <tt>String</tt>).</p>
- <pre>
- class ListAssertable t
- where listAssert :: [t] -> Assertion
-
- instance ListAssertable Char
- where listAssert = assertString
-</pre>
- <p>With the above declarations, <tt>(assert ())</tt>,
- <tt>(assert True)</tt>, and <tt>(assert "")</tt> (as well as
- <tt>IO</tt> forms of these values, such as <tt>(return ())</tt>) are all
- assertions that never fail, while <tt>(assert False)</tt> and
- <tt>(assert "some failure message")</tt> (and their
- <tt>IO</tt> forms) are assertions that always fail. You may define additional
- instances for the type classes <tt>Assertable</tt>, <tt>ListAssertable</tt>, and
- <tt>AssertionPredicable</tt> if that should be useful in your application.</p>
-
- <p>The overloaded <tt>test</tt> function in the <tt>Testable</tt> type class constructs a
- test.</p>
- <pre>
- class Testable t
- where test :: t -> Test
-
- instance Testable Test
- where test = id
-
- instance (Assertable t) => Testable (IO t)
- where test = TestCase . assert
-
- instance (Testable t) => Testable [t]
- where test = TestList . map test
-</pre>
- <p>The <tt>test</tt> function makes a test from either an <tt>Assertion</tt> (using
- <tt>TestCase</tt>), a list of <tt>Testable</tt> items (using <tt>TestList</tt>), or
- a <tt>Test</tt> (making no change).</p>
-
- <p>The following operators can be used to construct tests.</p>
- <pre>
- infix 1 ~?, ~=?, ~?=
- infixr 0 ~:
-
- (~?) :: (AssertionPredicable t) => t -> String -> Test
- pred ~? msg = TestCase (pred @? msg)
-
- (~=?) :: (Eq a, Show a) => a -> a -> Test
- expected ~=? actual = TestCase (expected @=? actual)
-
- (~?=) :: (Eq a, Show a) => a -> a -> Test
- actual ~?= expected = TestCase (actual @?= expected)
-
- (~:) :: (Testable t) => String -> t -> Test
- label ~: t = TestLabel label (test t)
-</pre>
- <p><tt>(~?)</tt>, <tt>(~=?)</tt>, and <tt>(~?=)</tt> each make an assertion, as for
- <tt>(@?)</tt>, <tt>(@=?)</tt>, and <tt>(@?=)</tt>, respectively, and then a test case
- from that assertion. <tt>(~:)</tt> attaches a label to something that is
- <tt>Testable</tt>. You may define additional instances for the type class
- <tt>Testable</tt> should that be useful.</p>
-
- <h2 id="RunningTests">Running Tests</h2>
-
- <p>HUnit is structured to support multiple test controllers. The first subsection below
- describes the <a href="#TestExecution">test execution</a> characteristics common to all
- test controllers. The second subsection describes the <a href="#Text-BasedController"
- >text-based controller</a> that is included with HUnit.</p>
-
- <h3 id="TestExecution">Test Execution</h3>
-
- <p>All test controllers share a common test execution model. They differ only in how the
- results of test execution are shown.</p>
-
- <p>The execution of a test (a value of type <tt>Test</tt>) involves the serial execution (in
- the <tt>IO</tt> monad) of its constituent test cases. The test cases are executed in a
- depth-first, left-to-right order. During test execution, four counts of test cases are
- maintained:</p>
- <pre>
- data Counts = Counts { cases, tried, errors, failures :: Int }
- deriving (Eq, Show, Read)
-</pre>
- <ul>
- <li><tt>cases</tt> is the number of test cases included in the test. This number is a
- static property of a test and remains unchanged during test execution.</li>
- <li><tt>tried</tt> is the number of test cases that have been executed so far during the
- test execution.</li>
- <li><tt>errors</tt> is the number of test cases whose execution ended with an unexpected
- exception being raised. Errors indicate problems with test cases, as opposed to the
- code under test.</li>
- <li><tt>failures</tt> is the number of test cases whose execution asserted failure.
- Failures indicate problems with the code under test.</li>
- </ul>
- <p>Why is there no count for test case successes? The technical reason is that the counts
- are maintained such that the number of test case successes is always equal to
- <tt>(tried - (errors + failures))</tt>. The
- psychosocial reason is that, with test-centered development and the expectation that
- test failures will be few and short-lived, attention should be focused on the failures
- rather than the successes.</p>
-
- <p>As test execution proceeds, three kinds of reporting event are communicated to the test
- controller. (What the controller does in response to the reporting events depends on the
- controller.)</p>
- <ul>
- <li><i>start</i> -- Just prior to initiation of a test case, the path of the test case
- and the current counts (excluding the current test case) are reported.</li>
- <li><i>error</i> -- When a test case terminates with an error, the error message is
- reported, along with the test case path and current counts (including the current
- test case).</li>
- <li><i>failure</i> -- When a test case terminates with a failure, the failure message is
- reported, along with the test case path and current counts (including the current
- test case).</li>
- </ul>
- <p>Typically, a test controller shows <i>error</i> and <i>failure</i> reports immediately
- but uses the <i>start</i> report merely to update an indication of overall test
- execution progress.</p>
-
- <h3 id="Text-BasedController">Text-Based Controller</h3>
-
- <p>A text-based test controller is included with HUnit.</p>
- <pre>
- runTestText :: PutText st -> Test -> IO (Counts, st)
-</pre>
- <p><tt>runTestText</tt> is generalized on a <i>reporting scheme</i> given as its first
- argument. During execution of the test given as its second argument, the controller
- creates a string for each reporting event and processes it according to the reporting
- scheme. When test execution is complete, the controller returns the final counts along
- with the final state for the reporting scheme.</p>
-
- <p>The strings for the three kinds of reporting event are as follows.</p>
- <ul>
- <li>A <i>start</i> report is the result of the function <tt>showCounts</tt> applied to
- the counts current immediately prior to initiation of the test case being started.</li>
- <li>An <i>error</i> report is of the form
- "<tt>Error in: <i>path</i>\n<i>message</i></tt>",
- where <i>path</i> is the path of the test case in error, as shown by
- <tt>showPath</tt>, and <i>message</i> is a message describing the error. If the path
- is empty, the report has the form "<tt>Error:\n<i>message</i></tt>".</li>
- <li>A <i>failure</i> report is of the form
- "<tt>Failure in: <i>path</i>\n<i>message</i></tt>", where
- <i>path</i> is the path of the test case in error, as shown by
- <tt>showPath</tt>, and <i>message</i> is the failure message. If the path is empty,
- the report has the form "<tt>Failure:\n<i>message</i></tt>".</li>
- </ul>
-
- <p>The function <tt>showCounts</tt> shows a set of counts.</p>
- <pre>
- showCounts :: Counts -> String
-</pre>
- <p>The form of its result is
- "<tt>Cases: <i>cases</i> Tried: <i>tried</i> Errors: <i>errors</i> Failures: <i>failures</i></tt>"
- where <i>cases</i>, <i>tried</i>, <i>errors</i>, and <i>failures</i> are the count
- values.</p>
-
- <p>The function <tt>showPath</tt> shows a test case path.</p>
- <pre>
- showPath :: Path -> String
-</pre>
- <p>The nodes in the path are reversed (so that the path reads from the root down to the test
- case), and the representations for the nodes are joined by '<tt>:</tt>' separators. The
- representation for <tt>(ListItem <i>n</i>)</tt> is <tt>(show n)</tt>. The representation
- for <tt>(Label <i>label</i>)</tt> is normally <i>label</i>. However, if <i>label</i>
- contains a colon or if <tt>(show <i>label</i>)</tt> is different from <i>label</i>
- surrounded by quotation marks--that is, if any ambiguity could exist--then <tt>(Label
- <i>label</i>)</tt> is represented as <tt>(show <i>label</i>)</tt>.</p>
-
- <p>HUnit includes two reporting schemes for the text-based test controller. You may define
- others if you wish.</p>
- <pre>
- putTextToHandle :: Handle -> Bool -> PutText Int
-</pre>
- <p><tt>putTextToHandle</tt> writes error and failure reports, plus a report of the final
- counts, to the given handle. Each of these reports is terminated by a newline. In
- addition, if the given flag is <tt>True</tt>, it writes start reports to the handle as
- well. A start report, however, is not terminated by a newline. Before the next report is
- written, the start report is "erased" with an appropriate sequence of carriage return
- and space characters. Such overwriting realizes its intended effect on terminal devices.</p>
- <pre>
- putTextToShowS :: PutText ShowS
-</pre>
- <p><tt>putTextToShowS</tt> ignores start reports and simply accumulates error and failure
- reports, terminating them with newlines. The accumulated reports are returned (as the
- second element of the pair returned by <tt>runTestText</tt>) as a <tt>ShowS</tt>
- function (that is, one with type <tt>(String -> String)</tt>) whose
- first argument is a string to be appended to the accumulated report lines.</p>
-
- <p>HUnit provides a shorthand for the most common use of the text-based test controller.</p>
- <pre>
- runTestTT :: Test -> IO Counts
-</pre>
- <p><tt>runTestTT</tt> invokes <tt>runTestText</tt>, specifying <tt>(putTextToHandle stderr
- True)</tt> for the reporting scheme, and returns the final counts from the test
- execution.</p>
-
-
- <h2 id="References">References</h2>
-
- <dl>
-
- <dt id="DesignPatterns">[1] Gamma, E., et al. Design Patterns: Elements of Reusable
- Object-Oriented Software, Addison-Wesley, Reading, MA, 1995.</dt>
- <dd>The classic book describing design patterns in an object-oriented context.</dd>
-
- <dt>
- <a href="http://www.junit.org">http://www.junit.org</a>
- </dt>
- <dd>Web page for JUnit, the tool after which HUnit is modeled.</dd>
-
- <dt>
- <a href="http://junit.sourceforge.net/doc/testinfected/testing.htm">
- http://junit.sourceforge.net/doc/testinfected/testing.htm</a>
- </dt>
- <dd>A good introduction to test-first development and the use of JUnit.</dd>
-
- <dt>
- <a href="http://junit.sourceforge.net/doc/cookstour/cookstour.htm">
- http://junit.sourceforge.net/doc/cookstour/cookstour.htm</a>
- </dt>
- <dd>A description of the internal structure of JUnit. Makes for an interesting
- comparison between JUnit and HUnit.</dd>
-
- </dl>
-
- <hr/>
-
- <p>The HUnit software and this guide were written by Dean Herington (<a
- href="mailto:heringto@cs.unc.edu">heringto(a)cs.unc.edu</a>).</p>
- </body>
-</html>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HUnit-1.3.1.0/examples/Example.hs new/HUnit-1.3.1.1/examples/Example.hs
--- old/HUnit-1.3.1.0/examples/Example.hs 2016-01-11 10:04:20.000000000 +0100
+++ new/HUnit-1.3.1.1/examples/Example.hs 2016-01-19 17:16:50.000000000 +0100
@@ -1,9 +1,9 @@
-- Example.hs -- Examples from HUnit user's guide
--
-- For more examples, check out the tests directory. It contains unit tests
--- for HUnit.
+-- for HUnit.
-module Main where
+module Example where
import Test.HUnit
@@ -36,5 +36,5 @@
partB y @? "(partB " ++ show y ++ ") failed" ]
main :: IO Counts
-main = do runTestTT tests
+main = do _ <- runTestTT tests
runTestTT tests'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HUnit-1.3.1.0/prologue.txt new/HUnit-1.3.1.1/prologue.txt
--- old/HUnit-1.3.1.0/prologue.txt 2016-01-11 10:04:20.000000000 +0100
+++ new/HUnit-1.3.1.1/prologue.txt 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-HUnit is a unit testing framework for Haskell, inspired by the JUnit
-tool for Java, see: <http://www.junit.org>.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HUnit-1.3.1.0/tests/HUnitTests.hs new/HUnit-1.3.1.1/tests/HUnitTests.hs
--- old/HUnit-1.3.1.0/tests/HUnitTests.hs 2016-01-11 10:04:20.000000000 +0100
+++ new/HUnit-1.3.1.1/tests/HUnitTests.hs 2016-01-19 17:16:50.000000000 +0100
@@ -10,6 +10,7 @@
import HUnitTestBase
import HUnitTestExtended
import TerminalTest
+import Example ()
main :: IO ()
main = do
1
0
Hello community,
here is the log from the commit of package ghc-http2 for openSUSE:Factory checked in at 2016-01-28 17:23:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-http2 (Old)
and /work/SRC/openSUSE:Factory/.ghc-http2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http2"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-http2/ghc-http2.changes 2016-01-07 00:25:22.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-http2.new/ghc-http2.changes 2016-01-28 17:24:44.000000000 +0100
@@ -1,0 +2,18 @@
+Fri Jan 22 10:05:24 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 1.4.4
+* Fixing a bug of reverse index.
+
+-------------------------------------------------------------------
+Wed Jan 20 09:47:10 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 1.4.3
+* Using proper baseDeficit for deletion.
+* Test files are now self-contained.
+* The reverse indices for static and dynamic are combined for performance.
+* Providing dequeueSTM, isEmpty and isEmptySTM. Users can compose their own control
+ queue with dequeueSTM and isEmptySTM.
+* Removing enqueueControl: it appeared that PriorityTree is not suitable for
+ control frames.
+
+-------------------------------------------------------------------
Old:
----
http2-1.3.1.tar.gz
New:
----
http2-1.4.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-http2.spec ++++++
--- /var/tmp/diff_new_pack.u08V0N/_old 2016-01-28 17:24:45.000000000 +0100
+++ /var/tmp/diff_new_pack.u08V0N/_new 2016-01-28 17:24:45.000000000 +0100
@@ -20,7 +20,7 @@
%bcond_with tests
Name: ghc-http2
-Version: 1.3.1
+Version: 1.4.4
Release: 0
Summary: HTTP/2.0 library including frames and HPACK
Group: System/Libraries
++++++ http2-1.3.1.tar.gz -> http2-1.4.4.tar.gz ++++++
++++ 1522626 lines of diff (skipped)
1
0
Hello community,
here is the log from the commit of package ghc-http-client for openSUSE:Factory checked in at 2016-01-28 17:23:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-http-client (Old)
and /work/SRC/openSUSE:Factory/.ghc-http-client.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-http-client"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-http-client/ghc-http-client.changes 2015-12-29 12:59:57.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-http-client.new/ghc-http-client.changes 2016-01-28 17:24:43.000000000 +0100
@@ -1,0 +2,6 @@
+Fri Jan 22 08:59:09 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 0.4.27
+* Enable managerModifyRequest to modify checkStatus
+
+-------------------------------------------------------------------
Old:
----
http-client-0.4.26.2.tar.gz
New:
----
http-client-0.4.27.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-http-client.spec ++++++
--- /var/tmp/diff_new_pack.HZxxgF/_old 2016-01-28 17:24:44.000000000 +0100
+++ /var/tmp/diff_new_pack.HZxxgF/_new 2016-01-28 17:24:44.000000000 +0100
@@ -21,7 +21,7 @@
%bcond_with tests
Name: ghc-http-client
-Version: 0.4.26.2
+Version: 0.4.27
Release: 0
Summary: HTTP client engine, intended as a base layer
License: MIT
++++++ http-client-0.4.26.2.tar.gz -> http-client-0.4.27.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.26.2/ChangeLog.md new/http-client-0.4.27/ChangeLog.md
--- old/http-client-0.4.26.2/ChangeLog.md 2015-12-22 18:46:34.000000000 +0100
+++ new/http-client-0.4.27/ChangeLog.md 2016-01-21 08:59:31.000000000 +0100
@@ -1,3 +1,7 @@
+## 0.4.27
+
+* Enable managerModifyRequest to modify checkStatus [#179](https://github.com/snoyberg/http-client/pull/179)
+
## 0.4.26.2
* Fix compilation for GHC 7.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.26.2/Network/HTTP/Client/Core.hs new/http-client-0.4.27/Network/HTTP/Client/Core.hs
--- old/http-client-0.4.26.2/Network/HTTP/Client/Core.hs 2015-12-22 18:46:34.000000000 +0100
+++ new/http-client-0.4.27/Network/HTTP/Client/Core.hs 2016-01-21 08:59:31.000000000 +0100
@@ -6,10 +6,12 @@
, httpLbs
, httpNoBody
, httpRaw
+ , httpRaw'
, responseOpen
, responseClose
, applyCheckStatus
, httpRedirect
+ , httpRedirect'
) where
#if !MIN_VERSION_base(4,6,0)
@@ -22,6 +24,7 @@
import Network.HTTP.Client.Request
import Network.HTTP.Client.Response
import Network.HTTP.Client.Cookies
+import Data.Maybe (fromMaybe, isJust)
import Data.Time
import Control.Exception
import qualified Data.ByteString as S
@@ -69,12 +72,22 @@
httpNoBody :: Request -> Manager -> IO (Response ())
httpNoBody req man = withResponse req man $ return . void
+
-- | Get a 'Response' without any redirect following.
httpRaw
:: Request
-> Manager
-> IO (Response BodyReader)
-httpRaw req0 m = do
+httpRaw = fmap (fmap snd) . httpRaw'
+
+-- | Get a 'Response' without any redirect following.
+--
+-- This extended version of 'httpRaw' also returns the Request potentially modified by @managerModifyRequest@.
+httpRaw'
+ :: Request
+ -> Manager
+ -> IO (Request, Response BodyReader)
+httpRaw' req0 m = do
req' <- mModifyRequest m $ mSetProxy m req0
(req, cookie_jar') <- case cookieJar req' of
Just cj -> do
@@ -100,7 +113,8 @@
-- Connection was reused, and might have been closed. Try again
(Left e, Reused) | mRetryableException m e -> do
connRelease DontReuse
- responseOpen req m
+ res <- responseOpen req m
+ return (req, res)
-- Not reused, or a non-retry, so this is a real exception
(Left e, _) -> throwIO e
-- Everything went ok, so the connection is good. If any exceptions get
@@ -109,8 +123,8 @@
Just _ -> do
now' <- getCurrentTime
let (cookie_jar, _) = updateCookieJar res req now' cookie_jar'
- return $ res {responseCookieJar = cookie_jar}
- Nothing -> return res
+ return (req, res {responseCookieJar = cookie_jar})
+ Nothing -> return (req, res)
where
responseTimeout' req
@@ -150,21 +164,21 @@
-- Since 0.1.0
responseOpen :: Request -> Manager -> IO (Response BodyReader)
responseOpen req0 manager = handle addTlsHostPort $ mWrapIOException manager $ do
- res <-
+ (req, res) <-
if redirectCount req0 == 0
- then httpRaw req0 manager
+ then httpRaw' req0 manager
else go (redirectCount req0) req0
- maybe (return res) throwIO =<< applyCheckStatus req0 (checkStatus req0) res
+ maybe (return res) throwIO =<< applyCheckStatus req (checkStatus req) res
where
addTlsHostPort (TlsException e) = throwIO $ TlsExceptionHostPort e (host req0) (port req0)
addTlsHostPort e = throwIO e
- go count req' = httpRedirect
+ go count req' = httpRedirect'
count
(\req -> do
- res <- httpRaw req manager
- let mreq = getRedirectedRequest req (responseHeaders res) (responseCookieJar res) (statusCode (responseStatus res))
- return (res, mreq))
+ (req'', res) <- httpRaw' req manager
+ let mreq = getRedirectedRequest req'' (responseHeaders res) (responseCookieJar res) (statusCode (responseStatus res))
+ return (res, fromMaybe req'' mreq, isJust mreq))
req'
-- | Apply 'Request'\'s 'checkStatus' and return resulting exception if any.
@@ -202,34 +216,49 @@
toStrict' = S.concat . L.toChunks
#endif
--- | Redirect loop
+-- | Redirect loop.
httpRedirect
:: Int -- ^ 'redirectCount'
-> (Request -> IO (Response BodyReader, Maybe Request)) -- ^ function which performs a request and returns a response, and possibly another request if there's a redirect.
-> Request
-> IO (Response BodyReader)
-httpRedirect count0 http' req0 = go count0 req0 []
+httpRedirect count0 http0 req0 = fmap snd $ httpRedirect' count0 http' req0
+ where
+ -- adapt callback API
+ http' req' = do
+ (res, mbReq) <- http0 req'
+ return (res, fromMaybe req0 mbReq, isJust mbReq)
+
+-- | Redirect loop.
+--
+-- This extended version of 'httpRaw' also returns the Request potentially modified by @managerModifyRequest@.
+httpRedirect'
+ :: Int -- ^ 'redirectCount'
+ -> (Request -> IO (Response BodyReader, Request, Bool)) -- ^ function which performs a request and returns a response, the potentially modified request, and a Bool indicating if there was a redirect.
+ -> Request
+ -> IO (Request, Response BodyReader)
+httpRedirect' count0 http' req0 = go count0 req0 []
where
go count _ ress | count < 0 = throwIO $ TooManyRedirects ress
go count req' ress = do
- (res, mreq) <- http' req'
- case mreq of
- Just req -> do
- -- Allow the original connection to return to the
- -- connection pool immediately by flushing the body.
- -- If the response body is too large, don't flush, but
- -- instead just close the connection.
- let maxFlush = 1024
- lbs <- brReadSome (responseBody res) maxFlush
- -- The connection may already be closed, e.g.
- -- when using withResponseHistory. See
- -- https://github.com/snoyberg/http-client/issues/169
- `catch` \(_ :: ConnectionClosed) -> return L.empty
- responseClose res
-
- -- And now perform the actual redirect
- go (count - 1) req (res { responseBody = lbs }:ress)
- Nothing -> return res
+ (res, req, isRedirect) <- http' req'
+ if isRedirect then do
+ -- Allow the original connection to return to the
+ -- connection pool immediately by flushing the body.
+ -- If the response body is too large, don't flush, but
+ -- instead just close the connection.
+ let maxFlush = 1024
+ lbs <- brReadSome (responseBody res) maxFlush
+ -- The connection may already be closed, e.g.
+ -- when using withResponseHistory. See
+ -- https://github.com/snoyberg/http-client/issues/169
+ `catch` \(_ :: ConnectionClosed) -> return L.empty
+ responseClose res
+
+ -- And now perform the actual redirect
+ go (count - 1) req (res { responseBody = lbs }:ress)
+ else
+ return (req, res)
-- | Close any open resources associated with the given @Response@. In general,
-- this will either close an active @Connection@ or return it to the @Manager@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.26.2/Network/HTTP/Client.hs new/http-client-0.4.27/Network/HTTP/Client.hs
--- old/http-client-0.4.26.2/Network/HTTP/Client.hs 2015-12-22 18:46:34.000000000 +0100
+++ new/http-client-0.4.27/Network/HTTP/Client.hs 2016-01-21 08:59:31.000000000 +0100
@@ -215,19 +215,19 @@
reqRef <- newIORef req0
historyRef <- newIORef id
let go req = do
- res <- httpRaw req man
+ (req', res) <- httpRaw' req man
case getRedirectedRequest
- req
+ req'
(responseHeaders res)
(responseCookieJar res)
(statusCode $ responseStatus res) of
- Nothing -> return (res, Nothing)
- Just req' -> do
- writeIORef reqRef req'
+ Nothing -> return (res, req', False)
+ Just req'' -> do
+ writeIORef reqRef req''
body <- brReadSome (responseBody res) 1024
modifyIORef historyRef (. ((req, res { responseBody = body }):))
- return (res, Just req')
- res <- httpRedirect (redirectCount req0) go req0
+ return (res, req'', True)
+ (_, res) <- httpRedirect' (redirectCount req0) go req0
reqFinal <- readIORef reqRef
history <- readIORef historyRef
return HistoriedResponse
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.26.2/http-client.cabal new/http-client-0.4.27/http-client.cabal
--- old/http-client-0.4.26.2/http-client.cabal 2015-12-22 18:46:34.000000000 +0100
+++ new/http-client-0.4.27/http-client.cabal 2016-01-21 08:59:31.000000000 +0100
@@ -1,5 +1,5 @@
name: http-client
-version: 0.4.26.2
+version: 0.4.27
synopsis: An HTTP client engine, intended as a base layer for more user-friendly packages.
description: Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/http-client>.
homepage: https://github.com/snoyberg/http-client
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/http-client-0.4.26.2/test/Network/HTTP/ClientSpec.hs new/http-client-0.4.27/test/Network/HTTP/ClientSpec.hs
--- old/http-client-0.4.26.2/test/Network/HTTP/ClientSpec.hs 2015-12-22 18:46:34.000000000 +0100
+++ new/http-client-0.4.27/test/Network/HTTP/ClientSpec.hs 2016-01-21 08:59:31.000000000 +0100
@@ -1,6 +1,7 @@
{-# LANGUAGE OverloadedStrings #-}
module Network.HTTP.ClientSpec where
+import Control.Exception (toException)
import Network (withSocketsDo)
import Network.HTTP.Client
import Network.HTTP.Types (status200)
@@ -24,3 +25,9 @@
withManager settings $ \man -> do
res <- httpLbs "http://httpbin.org:1234" man
responseStatus res `shouldBe` status200
+
+ it "managerModifyRequestCheckStatus" $ do
+ let modify req = return req { checkStatus = \s hs cj -> Just $ toException $ StatusCodeException s hs cj }
+ settings = defaultManagerSettings { managerModifyRequest = modify }
+ withManager settings $ \man ->
+ httpLbs "http://httpbin.org" man `shouldThrow` anyException
1
0
Hello community,
here is the log from the commit of package ghc-HTTP for openSUSE:Factory checked in at 2016-01-28 17:23:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-HTTP (Old)
and /work/SRC/openSUSE:Factory/.ghc-HTTP.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-HTTP"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-HTTP/ghc-HTTP.changes 2016-01-08 15:23:02.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-HTTP.new/ghc-HTTP.changes 2016-01-28 17:24:42.000000000 +0100
@@ -1,0 +2,19 @@
+Sun Jan 24 10:04:26 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 4000.3.2
+* If the URI contains "user:pass@" part, use it for Basic Authorization
+* Add a test harness.
+* Don't leak a socket when getHostAddr throws an exception.
+* Send cookies in request format, not response format.
+* Moved BrowserAction to be a StateT IO, with instances for
+ Applicative, MonadIO, MonadState.
+* Add method to control size of connection pool.
+* Consider both host and port when reusing connections.
+* Handle response code 304 "not modified" properly.
+* Fix digest authentication by fixing md5 output string rep.
+* Make the default user agent string follow the package version.
+* Document lack of HTTPS support and fail when clients try
+ to use it instead of silently falling back to HTTP.
+* Add helper to set the request type and body.
+
+-------------------------------------------------------------------
Old:
----
HTTP-4000.2.23.tar.gz
New:
----
HTTP-4000.3.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-HTTP.spec ++++++
--- /var/tmp/diff_new_pack.GyTEkh/_old 2016-01-28 17:24:43.000000000 +0100
+++ /var/tmp/diff_new_pack.GyTEkh/_new 2016-01-28 17:24:43.000000000 +0100
@@ -19,7 +19,7 @@
%global pkg_name HTTP
Name: ghc-HTTP
-Version: 4000.2.23
+Version: 4000.3.2
Release: 0
Summary: A library for client-side HTTP
License: BSD-3-Clause
@@ -37,7 +37,7 @@
BuildRequires: ghc-mtl-devel
BuildRequires: ghc-network-devel
BuildRequires: ghc-network-uri-devel
-BuildRequires: ghc-old-time-devel
+BuildRequires: ghc-time-devel
BuildRequires: ghc-parsec-devel
# End cabal-rpm deps
++++++ HTTP-4000.2.23.tar.gz -> HTTP-4000.3.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-4000.2.23/HTTP.cabal new/HTTP-4000.3.2/HTTP.cabal
--- old/HTTP-4000.2.23/HTTP.cabal 2015-12-31 23:33:18.000000000 +0100
+++ new/HTTP-4000.3.2/HTTP.cabal 2016-01-16 09:57:23.000000000 +0100
@@ -1,5 +1,5 @@
Name: HTTP
-Version: 4000.2.23
+Version: 4000.3.2
Cabal-Version: >= 1.8
Build-type: Simple
License: BSD3
@@ -99,7 +99,8 @@
-- note the test harness constraints should be kept in sync with these
-- where dependencies are shared
Build-depends: base >= 4.3.0.0 && < 4.9, parsec >= 2.0 && < 3.2
- Build-depends: array >= 0.3.0.2 && < 0.6, old-time >= 1.0.0.0 && < 1.2, bytestring >= 0.9.1.5 && < 0.11
+ Build-depends: array >= 0.3.0.2 && < 0.6, bytestring >= 0.9.1.5 && < 0.11
+ Build-depends: time >= 1.1.2.3 && < 1.7
Extensions: FlexibleInstances
@@ -114,8 +115,6 @@
else
Build-depends: network >= 2.2.1.8 && < 2.6
- build-tools: ghc >= 7.0 && < 7.12
-
if flag(warn-as-error)
ghc-options: -Werror
@@ -125,8 +124,6 @@
Test-Suite test
type: exitcode-stdio-1.0
- build-tools: ghc >= 7.0 && < 7.12
-
hs-source-dirs: test
main-is: httpTests.hs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-4000.2.23/Network/Browser.hs new/HTTP-4000.3.2/Network/Browser.hs
--- old/HTTP-4000.2.23/Network/Browser.hs 2015-12-31 23:33:18.000000000 +0100
+++ new/HTTP-4000.3.2/Network/Browser.hs 2016-01-16 09:57:23.000000000 +0100
@@ -149,7 +149,7 @@
( hSetBuffering, hPutStr, stdout, stdin, hGetChar
, BufferMode(NoBuffering, LineBuffering)
)
-import System.Time ( ClockTime, getClockTime )
+import Data.Time.Clock ( UTCTime, getCurrentTime )
------------------------------------------------------------------
@@ -638,7 +638,7 @@
-- at which they occurred.
data BrowserEvent
= BrowserEvent
- { browserTimestamp :: ClockTime
+ { browserTimestamp :: UTCTime
, browserRequestID :: RequestID
, browserRequestURI :: {-URI-}String
, browserEventType :: BrowserEventType
@@ -668,7 +668,7 @@
buildBrowserEvent :: BrowserEventType -> {-URI-}String -> RequestID -> IO BrowserEvent
buildBrowserEvent bt uri reqID = do
- ct <- getClockTime
+ ct <- getCurrentTime
return BrowserEvent
{ browserTimestamp = ct
, browserRequestID = reqID
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-4000.2.23/Network/TCP.hs new/HTTP-4000.3.2/Network/TCP.hs
--- old/HTTP-4000.2.23/Network/TCP.hs 2015-12-31 23:33:18.000000000 +0100
+++ new/HTTP-4000.3.2/Network/TCP.hs 2016-01-16 09:57:23.000000000 +0100
@@ -306,14 +306,7 @@
-- and that the connection peer matches the given
-- host name (which is recorded locally).
isConnectedTo :: Connection -> EndPoint -> IO Bool
-isConnectedTo (Connection conn) endPoint = do
- v <- readMVar (getRef conn)
- case v of
- ConnClosed -> print "aa" >> return False
- _
- | connEndPoint v == endPoint ->
- catchIO (getPeerName (connSock v) >> return True) (const $ return False)
- | otherwise -> return False
+isConnectedTo (Connection conn) endPoint = isTCPConnectedTo conn endPoint
isTCPConnectedTo :: HandleStream ty -> EndPoint -> IO Bool
isTCPConnectedTo conn endPoint = do
1
0
Hello community,
here is the log from the commit of package clinfo for openSUSE:Factory checked in at 2016-01-28 17:23:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/clinfo (Old)
and /work/SRC/openSUSE:Factory/.clinfo.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "clinfo"
Changes:
--------
--- /work/SRC/openSUSE:Factory/clinfo/clinfo.changes 2016-01-08 15:23:46.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.clinfo.new/clinfo.changes 2016-01-28 17:24:41.000000000 +0100
@@ -1,0 +2,6 @@
+Tue Jan 26 08:44:01 UTC 2016 - mpluskal(a)suse.com
+
+- Update to 2.1.16.01.12
+ * no upstream changelog provided
+
+-------------------------------------------------------------------
Old:
----
clinfo-2.1.16.01.06.tar.gz
New:
----
clinfo-2.1.16.01.12.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ clinfo.spec ++++++
--- /var/tmp/diff_new_pack.63rQk2/_old 2016-01-28 17:24:42.000000000 +0100
+++ /var/tmp/diff_new_pack.63rQk2/_new 2016-01-28 17:24:42.000000000 +0100
@@ -18,7 +18,7 @@
Name: clinfo
-Version: 2.1.16.01.06
+Version: 2.1.16.01.12
Release: 0
Summary: It reports status information for all installed OpenCL ICDs
License: SUSE-Public-Domain
@@ -45,15 +45,13 @@
make %{?_smp_mflags}
%install
-mkdir -p %{buildroot}/%{_bindir}
-mkdir -p %{buildroot}/%{_mandir}/man1/
-install -pm 0755 clinfo %{buildroot}/%{_bindir}
-install -pm 0644 man/clinfo.1 %{buildroot}/%{_mandir}/man1
+install -D -p -m 0755 clinfo %{buildroot}%{_bindir}/clinfo
+install -D -p -m 0644 man/clinfo.1 %{buildroot}%{_mandir}/man1/clinfo.1
%files
%defattr (-,root,root)
%doc LICENSE README
%{_bindir}/clinfo
-%{_mandir}/man1/clinfo.1.*
+%{_mandir}/man1/clinfo.1%{ext_man}
%changelog
++++++ clinfo-2.1.16.01.06.tar.gz -> clinfo-2.1.16.01.12.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clinfo-2.1.16.01.06/man/clinfo.1 new/clinfo-2.1.16.01.12/man/clinfo.1
--- old/clinfo-2.1.16.01.06/man/clinfo.1 2016-01-06 12:07:55.000000000 +0100
+++ new/clinfo-2.1.16.01.12/man/clinfo.1 2016-01-12 11:51:23.000000000 +0100
@@ -1,4 +1,4 @@
-.TH CLINFO 1 "2016-01-06" "clinfo 2.1.16.01.06"
+.TH CLINFO 1 "2016-01-12" "clinfo 2.1.16.01.12"
.SH NAME
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clinfo-2.1.16.01.06/src/clinfo.c new/clinfo-2.1.16.01.12/src/clinfo.c
--- old/clinfo-2.1.16.01.06/src/clinfo.c 2016-01-06 12:07:55.000000000 +0100
+++ new/clinfo-2.1.16.01.12/src/clinfo.c 2016-01-12 11:51:23.000000000 +0100
@@ -880,8 +880,9 @@
time_t time = val/UINT64_C(1000000000);
szval += snprintf(strbuf, bufsz, "%" PRIu64 "ns (", val);
szval += bufcpy(szval, ctime(&time));
+ /* overwrite ctime's newline with the closing parenthesis */
if (szval < bufsz)
- strbuf[szval] = ')';
+ strbuf[szval - 1] = ')';
}
show_strbuf(pname, 0);
return had_error;
@@ -2483,6 +2484,8 @@
const char *pname; // "ICD loader *"
};
+static const char * const oclicdl_pfx = "OCLICD";
+
#define LINFO(symbol, name) { symbol, #symbol, "ICD loader " name }
struct icdl_info_traits linfo_traits[] = {
LINFO(CL_ICDL_NAME, "Name"),
@@ -2541,9 +2544,18 @@
#endif
if (clGetICDLoaderInfoOCLICD != NULL) {
- puts("\nICD loader properties");
+ /* TODO think of a sensible header in CLINFO_RAW */
+ if (output_mode != CLINFO_RAW)
+ puts("\nICD loader properties");
current_function = __func__;
+ if (output_mode == CLINFO_RAW) {
+ line_pfx_len = strlen(oclicdl_pfx) + 5;
+ REALLOC(line_pfx, line_pfx_len, "line prefix OCL ICD");
+ sprintf(strbuf, "[%s/*]", oclicdl_pfx);
+ sprintf(line_pfx, "%*s", -line_pfx_len, strbuf);
+ }
+
for (current_line = 0; current_line < ARRAY_SIZE(linfo_traits); ++current_line) {
const struct icdl_info_traits *traits = linfo_traits + current_line;
current_param = traits->sname;
@@ -2586,7 +2598,7 @@
void version(void)
{
- puts("clinfo version 2.1.16.01.06");
+ puts("clinfo version 2.1.16.01.12");
}
void usage(void)
@@ -2674,7 +2686,8 @@
listPlatformsAndDevices(show_offline);
} else {
showDevices(show_offline);
- checkNullBehavior();
+ if (output_mode != CLINFO_RAW)
+ checkNullBehavior();
oclIcdProps();
}
1
0
Hello community,
here is the log from the commit of package perl-Mojolicious for openSUSE:Factory checked in at 2016-01-28 17:23:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious (Old)
and /work/SRC/openSUSE:Factory/.perl-Mojolicious.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious"
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Mojolicious/perl-Mojolicious.changes 2016-01-22 01:09:55.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.perl-Mojolicious.new/perl-Mojolicious.changes 2016-01-28 17:24:40.000000000 +0100
@@ -1,0 +2,18 @@
+Mon Jan 25 16:55:00 UTC 2016 - coolo(a)suse.com
+
+- updated to 6.42
+ see /usr/share/doc/packages/perl-Mojolicious/Changes
+
+ 6.42 2016-01-24
+ - Fixed use of deprecated Perl feature in Mojo::JSON.
+ - Fixed validation filter bugs in Mojolicious::Validator::Validation.
+
+ 6.41 2016-01-20
+ - Added support for validation filters.
+ - Added filters attribute to Mojolicious::Validator.
+ - Added add_filter method to Mojolicious::Validator.
+ - Added filter arguments to optional and required methods in
+ Mojolicious::Validator::Validation.
+ - Fixed MOJO_WEBSOCKET_DEBUG environment variable. (jberger)
+
+-------------------------------------------------------------------
Old:
----
Mojolicious-6.40.tar.gz
New:
----
Mojolicious-6.42.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Mojolicious.spec ++++++
--- /var/tmp/diff_new_pack.COY4ue/_old 2016-01-28 17:24:41.000000000 +0100
+++ /var/tmp/diff_new_pack.COY4ue/_new 2016-01-28 17:24:41.000000000 +0100
@@ -17,7 +17,7 @@
Name: perl-Mojolicious
-Version: 6.40
+Version: 6.42
Release: 0
%define cpan_name Mojolicious
Summary: Real-time web framework
++++++ Mojolicious-6.40.tar.gz -> Mojolicious-6.42.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/Changes new/Mojolicious-6.42/Changes
--- old/Mojolicious-6.40/Changes 2016-01-13 19:13:50.000000000 +0100
+++ new/Mojolicious-6.42/Changes 2016-01-24 23:00:27.000000000 +0100
@@ -1,4 +1,16 @@
+6.42 2016-01-24
+ - Fixed use of deprecated Perl feature in Mojo::JSON.
+ - Fixed validation filter bugs in Mojolicious::Validator::Validation.
+
+6.41 2016-01-20
+ - Added support for validation filters.
+ - Added filters attribute to Mojolicious::Validator.
+ - Added add_filter method to Mojolicious::Validator.
+ - Added filter arguments to optional and required methods in
+ Mojolicious::Validator::Validation.
+ - Fixed MOJO_WEBSOCKET_DEBUG environment variable. (jberger)
+
6.40 2016-01-13
- Removed client_challenge, client_handshake, server_handshake and server_open
methods from Mojo::Transaction::WebSocket. (batman, sri)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/META.json new/Mojolicious-6.42/META.json
--- old/Mojolicious-6.40/META.json 2016-01-13 21:07:28.000000000 +0100
+++ new/Mojolicious-6.42/META.json 2016-01-24 23:01:37.000000000 +0100
@@ -58,5 +58,5 @@
},
"x_IRC" : "irc://irc.perl.org/#mojo"
},
- "version" : "6.40"
+ "version" : "6.42"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/META.yml new/Mojolicious-6.42/META.yml
--- old/Mojolicious-6.40/META.yml 2016-01-13 21:07:28.000000000 +0100
+++ new/Mojolicious-6.42/META.yml 2016-01-24 23:01:37.000000000 +0100
@@ -31,4 +31,4 @@
homepage: http://mojolicious.org
license: http://www.opensource.org/licenses/artistic-license-2.0
repository: https://github.com/kraih/mojo.git
-version: '6.40'
+version: '6.42'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/README.md new/Mojolicious-6.42/README.md
--- old/Mojolicious-6.40/README.md 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/README.md 2016-01-24 04:33:27.000000000 +0100
@@ -11,23 +11,25 @@
## Features
- * An amazing real-time web framework, allowing you to easily grow single
+ * An amazing **real-time web framework**, allowing you to easily grow single
file prototypes into well-structured web applications.
* Powerful out of the box with RESTful routes, plugins, commands, Perl-ish
templates, content negotiation, session management, form validation,
testing framework, static file server, CGI/[PSGI](http://plackperl.org)
detection, first class Unicode support and much more for you to
discover.
+ * A powerful **web development toolkit**, that you can use for all kinds of
+ applications, independently of the web framework.
+ * Full stack HTTP and WebSocket client/server implementation with IPv6, TLS,
+ SNI, IDNA, HTTP/SOCKS5 proxy, Comet (long polling), keep-alive, connection
+ pooling, timeout, cookie, multipart, and gzip compression support.
+ * Built-in non-blocking I/O web server, supporting multiple event loops as
+ well as optional preforking and hot deployment, perfect for building
+ highly scalable web services.
+ * JSON and HTML/XML parser with CSS selector support.
* Very clean, portable and object-oriented pure-Perl API with no hidden
magic and no requirements besides Perl 5.22.0 (versions as old as 5.10.1
can be used too, but may require additional CPAN modules to be installed)
- * Full stack HTTP and WebSocket client/server implementation with IPv6, TLS,
- SNI, IDNA, HTTP/SOCKS5 proxy, Comet (long polling), keep-alive, connection
- pooling, timeout, cookie, multipart, and gzip compression support.
- * Built-in non-blocking I/O web server, supporting multiple event loops as
- well as optional preforking and hot deployment, perfect for building
- highly scalable web services.
- * JSON and HTML/XML parser with CSS selector support.
* Fresh code based upon years of experience developing
[Catalyst](http://www.catalystframework.org), free and open source.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo/Base.pm new/Mojolicious-6.42/lib/Mojo/Base.pm
--- old/Mojolicious-6.40/lib/Mojo/Base.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo/Base.pm 2016-01-19 19:23:42.000000000 +0100
@@ -115,7 +115,7 @@
use Mojo::Base -base;
has name => 'Nyan';
- has [qw(age weight)] => 4;
+ has ['age', 'weight'] => 4;
package Tiger;
use Mojo::Base 'Cat';
@@ -181,11 +181,11 @@
=head2 has
has 'name';
- has [qw(name1 name2 name3)];
+ has ['name1', 'name2', 'name3'];
has name => 'foo';
has name => sub {...};
- has [qw(name1 name2 name3)] => 'foo';
- has [qw(name1 name2 name3)] => sub {...};
+ has ['name1', 'name2', 'name3'] => 'foo';
+ has ['name1', 'name2', 'name3'] => sub {...};
Create attributes for hash-based objects, just like the L</"attr"> method.
@@ -197,11 +197,11 @@
$object->attr('name');
SubClass->attr('name');
- SubClass->attr([qw(name1 name2 name3)]);
+ SubClass->attr(['name1', 'name2', 'name3']);
SubClass->attr(name => 'foo');
SubClass->attr(name => sub {...});
- SubClass->attr([qw(name1 name2 name3)] => 'foo');
- SubClass->attr([qw(name1 name2 name3)] => sub {...});
+ SubClass->attr(['name1', 'name2', 'name3'] => 'foo');
+ SubClass->attr(['name1', 'name2', 'name3'] => sub {...});
Create attribute accessor for hash-based objects, an array reference can be
used to create more than one at a time. Pass an optional second argument to set
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo/Headers.pm new/Mojolicious-6.42/lib/Mojo/Headers.pm
--- old/Mojolicious-6.40/lib/Mojo/Headers.pm 2016-01-13 18:52:30.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo/Headers.pm 2016-01-23 01:38:17.000000000 +0100
@@ -482,7 +482,7 @@
my $names = $headers->names;
-Return a list of all currently defined headers.
+Return an array reference with all currently defined headers.
# Names of all headers
say for @{$headers->names};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo/IOLoop/Delay.pm new/Mojolicious-6.42/lib/Mojo/IOLoop/Delay.pm
--- old/Mojolicious-6.40/lib/Mojo/IOLoop/Delay.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo/IOLoop/Delay.pm 2016-01-19 19:37:41.000000000 +0100
@@ -224,8 +224,8 @@
my $hash = $delay->data;
my $foo = $delay->data('foo');
- $delay = $delay->data({foo => 'bar'});
- $delay = $delay->data(foo => 'bar');
+ $delay = $delay->data({foo => 'bar', baz => 23});
+ $delay = $delay->data(foo => 'bar', baz => 23);
Data shared between all L</"steps">.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo/JSON.pm new/Mojolicious-6.42/lib/Mojo/JSON.pm
--- old/Mojolicious-6.40/lib/Mojo/JSON.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo/JSON.pm 2016-01-24 19:03:27.000000000 +0100
@@ -1,6 +1,7 @@
package Mojo::JSON;
use Mojo::Base -strict;
+use B;
use Carp 'croak';
use Exporter 'import';
use JSON::PP ();
@@ -248,10 +249,9 @@
# Null
return 'null' unless defined $value;
- # Number (bitwise operators change behavior based on the internal value type)
- my $check = (my $dummy = "0") & $value;
+ # Number
return $value
- if (!($check ^ $check) && length $check)
+ if B::svref_2object(\$value)->FLAGS & (B::SVp_IOK | B::SVp_NOK)
&& 0 + $value eq $value
&& $value * 0 == 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo/Parameters.pm new/Mojolicious-6.42/lib/Mojo/Parameters.pm
--- old/Mojolicious-6.40/lib/Mojo/Parameters.pm 2016-01-13 19:03:30.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo/Parameters.pm 2016-01-23 01:38:38.000000000 +0100
@@ -283,7 +283,7 @@
my $names = $params->names;
-Return a list of all parameter names.
+Return an array reference with all parameter names.
# Names of all parameters
say for @{$params->names};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo/Server/Daemon.pm new/Mojolicious-6.42/lib/Mojo/Server/Daemon.pm
--- old/Mojolicious-6.40/lib/Mojo/Server/Daemon.pm 2016-01-13 07:05:52.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo/Server/Daemon.pm 2016-01-19 19:28:55.000000000 +0100
@@ -364,7 +364,7 @@
$daemon->listen(['http://*:8080?reuse=1']);
# Listen on two ports with HTTP and HTTPS at the same time
- $daemon->listen([qw(http://*:3000 https://*:4000)]);
+ $daemon->listen(['http://*:3000', 'https://*:4000']);
# Use a custom certificate and key
$daemon->listen(['https://*:3000?cert=/x/server.crt&key=/y/server.key']);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo/Transaction/HTTP.pm new/Mojolicious-6.42/lib/Mojo/Transaction/HTTP.pm
--- old/Mojolicious-6.40/lib/Mojo/Transaction/HTTP.pm 2016-01-13 18:56:08.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo/Transaction/HTTP.pm 2016-01-23 01:39:01.000000000 +0100
@@ -305,8 +305,8 @@
my $redirects = $tx->redirects;
-Return a list of all previous transactions that preceded this follow-up
-transaction.
+Return an array reference with all previous transactions that preceded this
+follow-up transaction.
# Paths of all previous requests
say $_->req->url->path for @{$tx->redirects};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo/Transaction/WebSocket.pm new/Mojolicious-6.42/lib/Mojo/Transaction/WebSocket.pm
--- old/Mojolicious-6.40/lib/Mojo/Transaction/WebSocket.pm 2016-01-13 18:57:55.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo/Transaction/WebSocket.pm 2016-01-19 20:32:28.000000000 +0100
@@ -136,8 +136,8 @@
my $self = shift;
my %protos = map { trim($_) => 1 } split ',',
- $self->req->headers->sec_websocket_protocol;
- return undef unless my $proto = first { $protos{$_} } @_;
+ $self->req->headers->sec_websocket_protocol // '';
+ return undef unless defined(my $proto = first { $protos{$_} } @_);
$self->res->headers->sec_websocket_protocol($proto);
return $proto;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo/UserAgent/Proxy.pm new/Mojolicious-6.42/lib/Mojo/UserAgent/Proxy.pm
--- old/Mojolicious-6.40/lib/Mojo/UserAgent/Proxy.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo/UserAgent/Proxy.pm 2016-01-19 19:28:23.000000000 +0100
@@ -75,7 +75,7 @@
=head2 not
my $not = $proxy->not;
- $proxy = $proxy->not([qw(localhost intranet.mojolicious.org)]);
+ $proxy = $proxy->not(['localhost', 'intranet.mojolicious.org']);
Domains that don't require a proxy server to be used.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo/UserAgent/Transactor.pm new/Mojolicious-6.42/lib/Mojo/UserAgent/Transactor.pm
--- old/Mojolicious-6.40/lib/Mojo/UserAgent/Transactor.pm 2016-01-12 21:25:33.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo/UserAgent/Transactor.pm 2016-01-19 19:28:02.000000000 +0100
@@ -114,8 +114,8 @@
# Generator
if (@_ > 1) {
- return $tx unless my $generator = $self->generators->{shift()};
- $self->$generator($tx, @_);
+ my $cb = $self->generators->{shift()};
+ $self->$cb($tx, @_);
}
# Body
@@ -328,6 +328,11 @@
Register a content generator.
+ $t->add_generator(foo => sub {
+ my ($t, $tx, @args) = @_;
+ ...
+ });
+
=head2 endpoint
my ($proto, $host, $port) = $t->endpoint(Mojo::Transaction::HTTP->new);
@@ -411,7 +416,8 @@
An array reference can be used for multiple form values sharing the same name.
# POST request with form values sharing the same name
- my $tx = $t->tx(POST => 'http://example.com' => form => {a => [qw(b c d)]});
+ my $tx = $t->tx(
+ POST => 'http://example.com' => form => {a => ['b', 'c', 'd']});
A hash reference with a C<content> or C<file> value can be used to switch to
the C<multipart/form-data> content type for file uploads.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo/WebSocket.pm new/Mojolicious-6.42/lib/Mojo/WebSocket.pm
--- old/Mojolicious-6.40/lib/Mojo/WebSocket.pm 2016-01-13 18:57:11.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo/WebSocket.pm 2016-01-19 16:57:09.000000000 +0100
@@ -3,7 +3,7 @@
use Config;
use Exporter 'import';
-use Mojo::Util qw(b64_encode sha1_bytes xor_encode);
+use Mojo::Util qw(b64_encode dumper sha1_bytes xor_encode);
use constant DEBUG => $ENV{MOJO_WEBSOCKET_DEBUG} || 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojo.pm new/Mojolicious-6.42/lib/Mojo.pm
--- old/Mojolicious-6.40/lib/Mojo.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojo.pm 2016-01-24 06:10:28.000000000 +0100
@@ -31,7 +31,7 @@
=head1 NAME
-Mojo - Duct tape for the HTML5 web!
+Mojo - Web development toolkit
=head1 SYNOPSIS
@@ -58,9 +58,11 @@
=head1 DESCRIPTION
-A flexible runtime environment for Perl real-time web frameworks, with all the
-basic tools and helpers needed to write simple web applications and higher
-level web frameworks, such as L<Mojolicious>.
+A powerful web development toolkit, with all the basic tools and helpers needed
+to write simple web applications and higher level web frameworks, such as
+L<Mojolicious>. Some of the most commonly used tools are L<Mojo::UserAgent>,
+L<Mojo::DOM>, L<Mojo::JSON>, L<Mojo::Server::Daemon>, L<Mojo::Server::Prefork>,
+L<Mojo::IOLoop> and L<Mojo::Template>.
See L<Mojolicious::Guides> for more!
@@ -115,8 +117,8 @@
my $hash = $app->config;
my $foo = $app->config('foo');
- $app = $app->config({foo => 'bar'});
- $app = $app->config(foo => 'bar');
+ $app = $app->config({foo => 'bar', baz => 23});
+ $app = $app->config(foo => 'bar', baz => 23);
Application configuration.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Controller.pm new/Mojolicious-6.42/lib/Mojolicious/Controller.pm
--- old/Mojolicious-6.40/lib/Mojolicious/Controller.pm 2016-01-12 21:50:53.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Controller.pm 2016-01-20 06:04:52.000000000 +0100
@@ -575,7 +575,7 @@
my $value = $c->param('foo');
$c = $c->param(foo => 'ba;r');
- $c = $c->param(foo => qw(ba;r baz));
+ $c = $c->param(foo => 'ba;r', 'baz');
$c = $c->param(foo => ['ba;r', 'baz']);
Access route placeholder values that are not reserved stash values, file
@@ -866,8 +866,8 @@
my $hash = $c->stash;
my $foo = $c->stash('foo');
- $c = $c->stash({foo => 'bar'});
- $c = $c->stash(foo => 'bar');
+ $c = $c->stash({foo => 'bar', baz => 23});
+ $c = $c->stash(foo => 'bar', baz => 23);
Non-persistent data storage and exchange for the current request, application
wide default values can be set with L<Mojolicious/"defaults">. Some stash
@@ -929,7 +929,7 @@
# Validate GET/POST parameter
my $validation = $c->validation;
- $validation->required('title')->size(3, 50);
+ $validation->required('title', 'trim')->size(3, 50);
my $title = $validation->param('title');
# Validate file upload
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Guides/Contributing.pod new/Mojolicious-6.42/lib/Mojolicious/Guides/Contributing.pod
--- old/Mojolicious-6.40/lib/Mojolicious/Guides/Contributing.pod 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Guides/Contributing.pod 2016-01-24 04:16:08.000000000 +0100
@@ -88,9 +88,9 @@
=head2 Mission statement
-L<Mojo> is a runtime environment for Perl real-time web frameworks. It provides
-all the basic tools and helpers needed to write simple web applications and
-higher level web frameworks, such as L<Mojolicious>.
+L<Mojo> is a web development toolkit, with all the basic tools and helpers
+needed to write simple web applications and higher level web frameworks, such as
+L<Mojolicious>.
All components should be reusable in other projects, and in a UNIXish way only
loosely coupled.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Guides/Rendering.pod new/Mojolicious-6.42/lib/Mojolicious/Guides/Rendering.pod
--- old/Mojolicious-6.40/lib/Mojolicious/Guides/Rendering.pod 2016-01-13 19:13:08.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Guides/Rendering.pod 2016-01-19 19:18:41.000000000 +0100
@@ -301,7 +301,7 @@
through the L<Mojolicious::Controller/"stash">.
$c->stash(description => 'web framework');
- $c->stash(frameworks => [qw(Catalyst Mojolicious)]);
+ $c->stash(frameworks => ['Catalyst', 'Mojolicious']);
$c->stash(spinoffs => {minion => 'job queue'});
%= $description
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Guides/Routing.pod new/Mojolicious-6.42/lib/Mojolicious/Guides/Routing.pod
--- old/Mojolicious-6.40/lib/Mojolicious/Guides/Routing.pod 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Guides/Routing.pod 2016-01-19 19:19:46.000000000 +0100
@@ -156,7 +156,7 @@
=head2 Minimal route
The attribute L<Mojolicious/"routes"> contains a router you can use to generate
-route structures, they match in the same order in which they were defined.
+route structures.
# Application
package MyApp;
@@ -175,7 +175,9 @@
1;
The minimal route above will load and instantiate the class
-C<MyApp::Controller::Foo> and call its C<welcome> method.
+C<MyApp::Controller::Foo> and call its C<welcome> method. Routes are usually
+configured in the C<startup> method of the application class, but the router can
+be accessed from everywhere (even at runtime).
# Controller
package MyApp::Controller::Foo;
@@ -191,8 +193,11 @@
1;
-Routes are usually configured in the C<startup> method of the application
-class, but the router can be accessed from everywhere (even at runtime).
+All routes match in the same order in which they were defined, and matching
+stops as soon as a suitable route has been found. So you can improve the routing
+performance by declaring your most frequently accessed routes first. A routing
+cache will also be used automatically to handle sudden traffic spikes more
+gracefully.
=head2 Routing destination
@@ -224,7 +229,7 @@
$r->post('/hello')->to(controller => 'foo', action => 'hello');
# GET|POST /bye -> {controller => 'foo', action => 'bye'}
- $r->any([qw(GET POST)] => '/bye')->to(controller => 'foo', action => 'bye');
+ $r->any(['GET', 'POST'] => '/bye')->to(controller => 'foo', action => 'bye');
# * /whatever -> {controller => 'foo', action => 'whatever'}
$r->any('/whatever')->to(controller => 'foo', action => 'whatever');
@@ -302,6 +307,10 @@
$cats->get('/nyan')->to(action => 'nyan');
$cats->get('/lol');
+With a few common prefixes you can also greatly improve the routing performance
+of applications with many routes, because children are only tried if the prefix
+matched first.
+
=head2 Special stash values
When the dispatcher sees C<controller> and C<action> values in the stash it
@@ -500,7 +509,7 @@
# /fry -> undef
# /bender -> {controller => 'foo', action => 'bar', name => 'bender'}
# /leela -> {controller => 'foo', action => 'bar', name => 'leela'}
- $r->get('/:name' => [name => [qw(bender leela)]])->to('foo#bar');
+ $r->get('/:name' => [name => ['bender', 'leela']])->to('foo#bar');
You can also adjust the regular expressions behind placeholders directly, just
make sure not to use C<^> and C<$> or capturing groups C<(...)>, because
@@ -595,7 +604,7 @@
# /foo.txt -> undef
# /foo.rss -> {controller => 'foo', action => 'bar', format => 'rss'}
# /foo.xml -> {controller => 'foo', action => 'bar', format => 'xml'}
- $r->get('/foo' => [format => [qw(rss xml)]])->to('foo#bar');
+ $r->get('/foo' => [format => ['rss', 'xml']])->to('foo#bar');
A C<format> value can also be passed to L<Mojolicious::Controller/"url_for">.
@@ -621,7 +630,7 @@
# /baz.xml -> undef
my $inactive = $r->under([format => 0]);
$inactive->get('/foo')->to('foo#bar');
- $inactive->get('/baz' => [format => [qw(txt html)]])->to('baz#yada');
+ $inactive->get('/baz' => [format => ['txt', 'html']])->to('baz#yada');
=head2 WebSockets
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Guides/Tutorial.pod new/Mojolicious-6.42/lib/Mojolicious/Guides/Tutorial.pod
--- old/Mojolicious-6.40/lib/Mojolicious/Guides/Tutorial.pod 2016-01-13 19:05:44.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Guides/Tutorial.pod 2016-01-19 19:20:21.000000000 +0100
@@ -7,7 +7,7 @@
=head1 TUTORIAL
-A quick example driven introduction to the wonders of L<Mojolicious::Lite>.
+A quick example-driven introduction to the wonders of L<Mojolicious::Lite>.
Almost everything you'll learn here also applies to full L<Mojolicious>
applications.
@@ -383,7 +383,7 @@
};
# GET|POST|PATCH /bye
- any [qw(GET POST PATCH)] => '/bye' => sub {
+ any ['GET', 'POST', 'PATCH'] => '/bye' => sub {
my $c = shift;
$c->render(text => 'Bye World!');
};
@@ -429,7 +429,7 @@
# /test
# /123
- any '/:foo' => [foo => [qw(test 123)]] => sub {
+ any '/:foo' => [foo => ['test', '123']] => sub {
my $c = shift;
my $foo = $c->param('foo');
$c->render(text => "Our :foo placeholder matched $foo");
@@ -581,7 +581,7 @@
# /hello.json
# /hello.txt
- get '/hello' => [format => [qw(json txt)]] => sub {
+ get '/hello' => [format => ['json', 'txt']] => sub {
my $c = shift;
return $c->render(json => {hello => 'world'})
if $c->stash('format') eq 'json';
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Guides.pod new/Mojolicious-6.42/lib/Mojolicious/Guides.pod
--- old/Mojolicious-6.40/lib/Mojolicious/Guides.pod 2016-01-10 21:28:01.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Guides.pod 2016-01-24 04:19:02.000000000 +0100
@@ -84,9 +84,9 @@
=head1 HIGHLIGHTS
-L<Mojolicious> and L<Mojolicious::Lite> are the sum of many parts, small
-building blocks that can be used independently, these are the most prominent
-ones.
+L<Mojolicious> and L<Mojolicious::Lite> are the sum of many parts, built on top
+of the L<Mojo> web development toolkit. Small building blocks that can be used
+independently for all kinds of applications, these are the most prominent ones.
=over 2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Lite.pm new/Mojolicious-6.42/lib/Mojolicious/Lite.pm
--- old/Mojolicious-6.40/lib/Mojolicious/Lite.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Lite.pm 2016-01-19 19:26:47.000000000 +0100
@@ -96,8 +96,8 @@
my $route = any '/:foo' => sub {...};
my $route = any '/:foo' => {foo => 'bar'} => sub {...};
my $route = any '/:foo' => [foo => qr/\w+/] => sub {...};
- my $route = any [qw(GET POST)] => '/:foo' => sub {...};
- my $route = any [qw(GET POST)] => '/:foo' => [foo => qr/\w+/] => sub {...};
+ my $route = any ['GET', 'POST'] => '/:foo' => sub {...};
+ my $route = any ['GET', 'POST'] => '/:foo' => [foo => qr/\w+/] => sub {...};
Generate route with L<Mojolicious::Routes::Route/"any">, matching any of the
listed HTTP request methods or all. See also L<Mojolicious::Guides::Tutorial>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Plugin/DefaultHelpers.pm new/Mojolicious-6.42/lib/Mojolicious/Plugin/DefaultHelpers.pm
--- old/Mojolicious-6.40/lib/Mojolicious/Plugin/DefaultHelpers.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Plugin/DefaultHelpers.pm 2016-01-19 19:26:20.000000000 +0100
@@ -219,7 +219,7 @@
=head2 c
- %= c(qw(a b c))->shuffle->join
+ %= c('a', 'b', 'c')->shuffle->join
Turn list into a L<Mojo::Collection> object.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Plugin/TagHelpers.pm new/Mojolicious-6.42/lib/Mojolicious/Plugin/TagHelpers.pm
--- old/Mojolicious-6.40/lib/Mojolicious/Plugin/TagHelpers.pm 2016-01-13 18:54:26.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Plugin/TagHelpers.pm 2016-01-19 19:25:49.000000000 +0100
@@ -553,11 +553,11 @@
=head2 select_field
- %= select_field country => [qw(de en)]
+ %= select_field country => ['de', 'en']
%= select_field country => [[Germany => 'de'], 'en'], id => 'eu'
%= select_field country => [[Germany => 'de', selected => 'selected'], 'en']
%= select_field country => [c(EU => [[Germany => 'de'], 'en'], id => 'eu')]
- %= select_field country => [c(EU => [qw(de en)]), c(Asia => [qw(cn jp)])]
+ %= select_field country => [c(EU => ['de', 'en']), c(Asia => ['cn', 'jp'])]
Generate C<select> and C<option> tags from array references and C<optgroup>
tags from L<Mojo::Collection> objects. Previous input values will automatically
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Renderer.pm new/Mojolicious-6.42/lib/Mojolicious/Renderer.pm
--- old/Mojolicious-6.40/lib/Mojolicious/Renderer.pm 2016-01-13 19:13:26.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Renderer.pm 2016-01-15 18:01:51.000000000 +0100
@@ -372,12 +372,23 @@
Register a handler.
+ $renderer->add_handler(foo => sub {
+ my ($renderer, $c, $output, $options) = @_;
+ ...
+ $$output = 'Hello World!';
+ });
+
=head2 add_helper
$renderer = $renderer->add_helper(url_for => sub {...});
Register a helper.
+ $renderer->add_helper(foo => sub {
+ my ($c, @args) = @_;
+ ...
+ });
+
=head2 get_data_template
my $template = $renderer->get_data_template({
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Routes/Route.pm new/Mojolicious-6.42/lib/Mojolicious/Routes/Route.pm
--- old/Mojolicious-6.40/lib/Mojolicious/Routes/Route.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Routes/Route.pm 2016-01-19 19:21:37.000000000 +0100
@@ -302,8 +302,8 @@
my $route = $r->any('/:foo' => sub {...});
my $route = $r->any('/:foo' => {foo => 'bar'} => sub {...});
my $route = $r->any('/:foo' => [foo => qr/\w+/] => sub {...});
- my $route = $r->any([qw(GET POST)] => '/:foo' => sub {...});
- my $route = $r->any([qw(GET POST)] => '/:foo' => [foo => qr/\w+/]);
+ my $route = $r->any(['GET', 'POST'] => '/:foo' => sub {...});
+ my $route = $r->any(['GET', 'POST'] => '/:foo' => [foo => qr/\w+/]);
Generate L<Mojolicious::Routes::Route> object matching any of the listed HTTP
request methods or all. See also L<Mojolicious::Guides::Tutorial> for many more
@@ -564,14 +564,14 @@
my $methods = $r->via;
$r = $r->via('GET');
- $r = $r->via(qw(GET POST));
- $r = $r->via([qw(GET POST)]);
+ $r = $r->via('GET', 'POST');
+ $r = $r->via(['GET', 'POST']);
Restrict HTTP methods this route is allowed to handle, defaults to no
restrictions.
# Route with two methods and destination
- $r->route('/foo')->via(qw(GET POST))->to('foo#bar');
+ $r->route('/foo')->via('GET', 'POST')->to('foo#bar');
=head2 websocket
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Routes.pm new/Mojolicious-6.42/lib/Mojolicious/Routes.pm
--- old/Mojolicious-6.40/lib/Mojolicious/Routes.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Routes.pm 2016-01-19 19:22:21.000000000 +0100
@@ -257,7 +257,7 @@
=head2 hidden
my $hidden = $r->hidden;
- $r = $r->hidden([qw(attr has new)]);
+ $r = $r->hidden(['attr', 'has', 'new']);
Controller attributes and methods that are hidden from router, defaults to
C<attr>, C<has>, C<new> and C<tap>.
@@ -290,12 +290,23 @@
Register a condition.
+ $r->add_condition(foo => sub {
+ my ($route, $c, $captures, $arg) = @_;
+ ...
+ return 1;
+ });
+
=head2 add_shortcut
$r = $r->add_shortcut(foo => sub {...});
Register a shortcut.
+ $r->add_shortcut(foo => sub {
+ my ($route, @args) = @_;
+ ...
+ });
+
=head2 continue
$r->continue(Mojolicious::Controller->new);
@@ -311,7 +322,7 @@
=head2 hide
- $r = $r->hide(qw(foo bar));
+ $r = $r->hide('foo', 'bar');
Hide controller attributes and methods from router.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Types.pm new/Mojolicious-6.42/lib/Mojolicious/Types.pm
--- old/Mojolicious-6.40/lib/Mojolicious/Types.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Types.pm 2016-01-19 19:25:06.000000000 +0100
@@ -140,7 +140,7 @@
my $type = $types->type('png');
$types = $types->type(png => 'image/png');
- $types = $types->type(json => [qw(application/json text/x-json)]);
+ $types = $types->type(json => ['application/json', 'text/x-json']);
Get or set MIME types for file extension, alternatives are only used for
detection.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Validator/Validation.pm new/Mojolicious-6.42/lib/Mojolicious/Validator/Validation.pm
--- old/Mojolicious-6.40/lib/Mojolicious/Validator/Validation.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Validator/Validation.pm 2016-01-24 00:43:47.000000000 +0100
@@ -64,12 +64,16 @@
sub is_valid { exists $_[0]->output->{$_[1] // $_[0]->topic} }
sub optional {
- my ($self, $name) = @_;
+ my ($self, $name, @filters) = @_;
- my $input = $self->input->{$name};
- my @input = ref $input eq 'ARRAY' ? @$input : $input;
- $self->output->{$name} = $input
- unless grep { !defined($_) || $_ eq '' } @input;
+ return $self->topic($name) unless defined(my $input = $self->input->{$name});
+
+ my @input = ref $input eq 'ARRAY' ? @$input : ($input);
+ for my $cb (map { $self->validator->filters->{$_} } @filters) {
+ @input = map { $self->$cb($name, $_) } @input;
+ }
+ $self->output->{$name} = @input > 1 ? \@input : $input[0]
+ unless grep { $_ eq '' } @input;
return $self->topic($name);
}
@@ -79,8 +83,8 @@
sub passed { [sort keys %{shift->output}] }
sub required {
- my ($self, $name) = @_;
- return $self if $self->optional($name)->is_valid;
+ my ($self, $name) = (shift, shift);
+ return $self if $self->optional($name, @_)->is_valid;
return $self->error($name => ['required']);
}
@@ -101,7 +105,7 @@
my $validation
= Mojolicious::Validator::Validation->new(validator => $validator);
$validation->input({foo => 'bar'});
- $validation->required('foo')->in(qw(bar baz));
+ $validation->required('foo')->in('bar', 'baz');
say $validation->param('foo');
=head1 DESCRIPTION
@@ -191,7 +195,7 @@
my $names = $validation->failed;
-Return a list of all names for values that failed validation.
+Return an array reference with all names for values that failed validation.
# Names of all values that failed
say for @{$validation->failed};
@@ -220,8 +224,12 @@
=head2 optional
$validation = $validation->optional('foo');
+ $validation = $validation->optional('foo', 'filter1', 'filter2');
+
+Change validation L</"topic"> and apply filters.
-Change validation L</"topic">.
+ # Trim value and check size
+ $validation->optional('user', 'trim')->size(1, 15);
=head2 param
@@ -234,7 +242,7 @@
my $names = $validation->passed;
-Return a list of all names for values that passed validation.
+Return an array reference with all names for values that passed validation.
# Names of all values that passed
say for @{$validation->passed};
@@ -242,9 +250,13 @@
=head2 required
$validation = $validation->required('foo');
+ $validation = $validation->required('foo', 'filter1', 'filter2');
+
+Change validation L</"topic">, apply filters, and make sure a value is present
+and not an empty string.
-Change validation L</"topic"> and make sure a value is present and not an empty
-string.
+ # Trim value and check size
+ $validation->required('user', 'trim')->size(1, 15);
=head1 AUTOLOAD
@@ -255,10 +267,10 @@
# Call validation checks
$validation->required('foo')->size(2, 5)->like(qr/^[A-Z]/);
$validation->optional('bar')->equal_to('foo');
- $validation->optional('baz')->in(qw(test 123));
+ $validation->optional('baz')->in('test', '123');
# Longer version
- $validation->required('foo')->check('size', 2,5)->check('like', qr/^[A-Z]/);
+ $validation->required('foo')->check('size', 2, 5)->check('like', qr/^[A-Z]/);
=head1 SEE ALSO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious/Validator.pm new/Mojolicious-6.42/lib/Mojolicious/Validator.pm
--- old/Mojolicious-6.40/lib/Mojolicious/Validator.pm 2016-01-09 05:25:41.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious/Validator.pm 2016-01-20 06:04:56.000000000 +0100
@@ -1,6 +1,7 @@
package Mojolicious::Validator;
use Mojo::Base -base;
+use Mojo::Util 'trim';
use Mojolicious::Validator::Validation;
has checks => sub {
@@ -12,8 +13,10 @@
upload => sub { !ref $_[2] || !$_[2]->isa('Mojo::Upload') }
};
};
+has filters => sub { {trim => \&_trim} };
-sub add_check { $_[0]->checks->{$_[1]} = $_[2] and return $_[0] }
+sub add_check { $_[0]->checks->{$_[1]} = $_[2] and return $_[0] }
+sub add_filter { $_[0]->filters->{$_[1]} = $_[2] and return $_[0] }
sub validation {
Mojolicious::Validator::Validation->new(validator => shift);
@@ -37,6 +40,8 @@
return $len < $min || $len > $max;
}
+sub _trim { trim $_[2] }
+
1;
=encoding utf8
@@ -71,7 +76,7 @@
=head2 in
- $validation = $validation->in(qw(foo bar baz));
+ $validation = $validation->in('foo', 'bar', 'baz');
String value needs to match one of the values in the list.
@@ -94,6 +99,17 @@
Value needs to be a L<Mojo::Upload> object, representing a file upload.
+=head1 FILTERS
+
+These filters are available by default.
+
+=head2 trim
+
+ $validation = $validation->optional('foo', 'trim');
+
+Trim whitespace characters from both ends of string value with
+L<Mojo::Util/"trim">.
+
=head1 ATTRIBUTES
L<Mojolicious::Validator> implements the following attributes.
@@ -117,6 +133,24 @@
Register a validation check.
+ $validator->add_check(foo => sub {
+ my ($validation, $name, $value, @args) = @_;
+ ...
+ return undef;
+ });
+
+=head2 add_filter
+
+ $validator = $validator->add_filter(trim => sub {...});
+
+Register a new filter.
+
+ $validator->add_filter(foo => sub {
+ my ($validation, $name, $value) = @_;
+ ...
+ return $value;
+ });
+
=head2 validation
my $validation = $validator->validation;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/lib/Mojolicious.pm new/Mojolicious-6.42/lib/Mojolicious.pm
--- old/Mojolicious-6.40/lib/Mojolicious.pm 2016-01-11 19:14:50.000000000 +0100
+++ new/Mojolicious-6.42/lib/Mojolicious.pm 2016-01-20 21:02:19.000000000 +0100
@@ -43,7 +43,7 @@
has validator => sub { Mojolicious::Validator->new };
our $CODENAME = 'Clinking Beer Mugs';
-our $VERSION = '6.40';
+our $VERSION = '6.42';
sub AUTOLOAD {
my $self = shift;
@@ -523,6 +523,12 @@
return $value ne 'foo';
});
+ # Add validation filter
+ $app->validator->add_filter(quotemeta => sub {
+ my ($validation, $name, $value) = @_;
+ return quotemeta $value;
+ });
+
=head1 METHODS
L<Mojolicious> inherits all methods from L<Mojo> and implements the following
@@ -549,8 +555,8 @@
my $hash = $app->defaults;
my $foo = $app->defaults('foo');
- $app = $app->defaults({foo => 'bar'});
- $app = $app->defaults(foo => 'bar');
+ $app = $app->defaults({foo => 'bar', baz => 23});
+ $app = $app->defaults(foo => 'bar', baz => 23);
Default values for L<Mojolicious::Controller/"stash">, assigned for every new
request.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/t/mojolicious/validation_lite_app.t new/Mojolicious-6.42/t/mojolicious/validation_lite_app.t
--- old/Mojolicious-6.40/t/mojolicious/validation_lite_app.t 2016-01-12 23:31:46.000000000 +0100
+++ new/Mojolicious-6.42/t/mojolicious/validation_lite_app.t 2016-01-24 00:44:26.000000000 +0100
@@ -9,7 +9,7 @@
use Test::Mojo;
# Custom check
-app->validator->add_check(two => sub { length $_[2] == 2 ? undef : 'ohoh' });
+app->validator->add_check(two => sub { length $_[2] == 2 ? undef : "e:$_[1]" });
any '/' => sub {
my $c = shift;
@@ -161,6 +161,27 @@
is_deeply $validation->error('bar'), [qw(size 1 1 6)], 'right error';
is_deeply $validation->failed, ['bar'], 'right names';
+# Trim
+$validation = $t->app->validation->input({foo => ' bar', baz => [' 0 ', 1]});
+ok $validation->required('foo', 'trim')->in('bar')->is_valid, 'valid';
+is_deeply $validation->output, {foo => 'bar'}, 'right result';
+ok !$validation->optional('missing', 'trim')->is_valid, 'not valid';
+ok $validation->optional('baz', 'trim')->like(qr/^\d$/)->is_valid, 'valid';
+is_deeply $validation->output, {foo => 'bar', baz => [0, 1]}, 'right result';
+$validation = $t->app->validation->input({nothing => ' '});
+ok !$validation->required('nothing', 'trim')->is_valid, 'not valid';
+is_deeply $validation->output, {}, 'right result';
+ok $validation->required('nothing')->is_valid, 'valid';
+is_deeply $validation->output, {nothing => ' '}, 'right result';
+
+# Custom filter
+$t->app->validator->add_filter(quote => sub {qq{$_[1]="$_[2]"}});
+$validation = $t->app->validation->input({foo => [' bar', 'baz']});
+ok $validation->required('foo', 'trim', 'quote')->like(qr/"/)->is_valid,
+ 'valid';
+is_deeply $validation->output, {foo => ['foo="bar"', 'foo="baz"']},
+ 'right result';
+
# Multiple empty values
$validation = $t->app->validation;
ok !$validation->has_data, 'no data';
@@ -306,7 +327,7 @@
}
);
$t->get_ok('/?foo=too_long&bar=too_long_too&baz=way_too_long&yada=whatever')
- ->status_is(200)->text_is('div:root' => 'two ohoh')
+ ->status_is(200)->text_is('div:root' => 'two e:foo')
->text_is('label.custom.my-field-with-error[for="foo"]' => '<Foo>')
->element_exists('input.custom.my-field-with-error[type="text"]')
->element_exists('textarea.my-field-with-error')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-6.40/t/mojolicious/websocket_lite_app.t new/Mojolicious-6.42/t/mojolicious/websocket_lite_app.t
--- old/Mojolicious-6.40/t/mojolicious/websocket_lite_app.t 2016-01-11 06:57:53.000000000 +0100
+++ new/Mojolicious-6.42/t/mojolicious/websocket_lite_app.t 2016-01-19 20:32:25.000000000 +0100
@@ -29,7 +29,7 @@
websocket '/protocols' => sub {
my $c = shift;
- $c->send($c->tx->with_protocols('foo', 'bar', 'baz') // 'none');
+ $c->send($c->tx->with_protocols('foo', 'bar', 'baz', '0') // 'none');
$c->send($c->tx->protocol // 'none');
};
@@ -225,12 +225,20 @@
is $t->tx->protocol, 'foo', 'right protocol';
is $t->tx->res->headers->sec_websocket_protocol, 'foo',
'right "Sec-WebSocket-Protocol" value';
+$t->websocket_ok('/protocols' => ['0'])->message_ok->message_is('0')
+ ->message_ok->message_is('0')->finish_ok;
+is $t->tx->protocol, '0', 'right protocol';
+is $t->tx->res->headers->sec_websocket_protocol, '0',
+ 'right "Sec-WebSocket-Protocol" value';
$t->websocket_ok('/protocols' => [''])->message_ok->message_is('none')
->message_ok->message_is('none')->finish_ok;
is $t->tx->protocol, undef, 'no protocol';
$t->websocket_ok('/protocols' => ['', '', ''])->message_ok->message_is('none')
->message_ok->message_is('none')->finish_ok;
is $t->tx->protocol, undef, 'no protocol';
+$t->websocket_ok('/protocols')->message_ok->message_is('none')
+ ->message_ok->message_is('none')->finish_ok;
+is $t->tx->protocol, undef, 'no protocol';
# JSON roundtrips (with a lot of different tests)
$t->websocket_ok('/json')->send_ok({json => {test => 23, snowman => '☃'}})
1
0
Hello community,
here is the log from the commit of package ghc-fclabels for openSUSE:Factory checked in at 2016-01-28 17:23:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-fclabels (Old)
and /work/SRC/openSUSE:Factory/.ghc-fclabels.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-fclabels"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-fclabels/ghc-fclabels.changes 2015-09-17 09:19:17.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-fclabels.new/ghc-fclabels.changes 2016-01-28 17:24:39.000000000 +0100
@@ -1,0 +2,6 @@
+Wed Jan 20 09:43:35 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 2.0.2.4
+* Allow transformers 0.5.*.
+
+-------------------------------------------------------------------
Old:
----
fclabels-2.0.2.3.tar.gz
New:
----
fclabels-2.0.2.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-fclabels.spec ++++++
--- /var/tmp/diff_new_pack.CnXA01/_old 2016-01-28 17:24:39.000000000 +0100
+++ /var/tmp/diff_new_pack.CnXA01/_new 2016-01-28 17:24:39.000000000 +0100
@@ -21,7 +21,7 @@
%bcond_without tests
Name: ghc-fclabels
-Version: 2.0.2.3
+Version: 2.0.2.4
Release: 0
Summary: First class accessor labels implemented as lenses
License: BSD-3-Clause
++++++ fclabels-2.0.2.3.tar.gz -> fclabels-2.0.2.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fclabels-2.0.2.3/CHANGELOG new/fclabels-2.0.2.4/CHANGELOG
--- old/fclabels-2.0.2.3/CHANGELOG 2015-09-04 19:49:24.000000000 +0200
+++ new/fclabels-2.0.2.4/CHANGELOG 2016-01-18 14:18:19.000000000 +0100
@@ -1,8 +1,12 @@
CHANGELOG
+2.0.2.3 to 2.0.2.4
+
+ - Allow transformers 0.5.*.
+
2.0.2.2 to 2.0.2.3
- - Allow HUNit 1.3.*
+ - Allow HUnit 1.3.*
2.0.2.1 to 2.0.2.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fclabels-2.0.2.3/fclabels.cabal new/fclabels-2.0.2.4/fclabels.cabal
--- old/fclabels-2.0.2.3/fclabels.cabal 2015-09-04 19:49:24.000000000 +0200
+++ new/fclabels-2.0.2.4/fclabels.cabal 2016-01-18 14:18:19.000000000 +0100
@@ -1,5 +1,5 @@
Name: fclabels
-Version: 2.0.2.3
+Version: 2.0.2.4
Author: Sebastiaan Visser, Erik Hesselink, Chris Eidhof, Sjoerd Visscher
with lots of help and feedback from others.
Synopsis: First class accessor labels implemented as lenses.
@@ -81,7 +81,7 @@
base < 5
, template-haskell >= 2.2 && < 2.11
, mtl >= 1.0 && < 2.3
- , transformers >= 0.2 && < 0.5
+ , transformers >= 0.2 && < 0.6
Source-Repository head
Type: git
1
0
Hello community,
here is the log from the commit of package ghc-errors for openSUSE:Factory checked in at 2016-01-28 17:23:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-errors (Old)
and /work/SRC/openSUSE:Factory/.ghc-errors.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-errors"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-errors/ghc-errors.changes 2015-12-29 12:59:24.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-errors.new/ghc-errors.changes 2016-01-28 17:24:38.000000000 +0100
@@ -1,0 +2,11 @@
+Wed Jan 20 09:14:30 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 2.1.1
+* Increase upper bound on transformers-compat
+
+-------------------------------------------------------------------
+Mon Jan 11 07:51:40 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 2.1.0
+
+-------------------------------------------------------------------
Old:
----
errors-2.0.1.tar.gz
New:
----
errors-2.1.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-errors.spec ++++++
--- /var/tmp/diff_new_pack.yi2PNP/_old 2016-01-28 17:24:38.000000000 +0100
+++ /var/tmp/diff_new_pack.yi2PNP/_new 2016-01-28 17:24:38.000000000 +0100
@@ -18,7 +18,7 @@
%global pkg_name errors
Name: ghc-errors
-Version: 2.0.1
+Version: 2.1.1
Release: 0
Summary: Simplified error-handling
Group: System/Libraries
@@ -34,6 +34,7 @@
BuildRequires: ghc-safe-devel
BuildRequires: ghc-transformers-compat-devel
BuildRequires: ghc-transformers-devel
+BuildRequires: ghc-unexceptionalio-devel
# End cabal-rpm deps
%description
++++++ errors-2.0.1.tar.gz -> errors-2.1.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/errors-2.0.1/Control/Error/Util.hs new/errors-2.1.1/Control/Error/Util.hs
--- old/errors-2.0.1/Control/Error/Util.hs 2015-09-15 20:38:27.000000000 +0200
+++ new/errors-2.1.1/Control/Error/Util.hs 2016-01-16 23:09:57.000000000 +0100
@@ -51,7 +51,7 @@
) where
import Control.Applicative (Applicative, pure, (<$>))
-import qualified Control.Exception as Ex
+import Control.Exception (Handler(..), IOException, SomeException)
import Control.Monad (liftM)
import Control.Monad.IO.Class (MonadIO(liftIO))
import Control.Monad.Trans.Except (ExceptT(ExceptT), runExceptT)
@@ -61,6 +61,10 @@
import Data.Maybe (fromMaybe)
import System.Exit (ExitCode)
import System.IO (hPutStr, hPutStrLn, stderr)
+import UnexceptionalIO (UIO, Unexceptional)
+
+import qualified Control.Exception as Exception
+import qualified UnexceptionalIO as UIO
-- | Fold an 'ExceptT' by providing one continuation for each constructor
exceptT :: Monad m => (a -> m c) -> (b -> m c) -> ExceptT a m b -> m c
@@ -231,31 +235,12 @@
errLn :: String -> IO ()
errLn = hPutStrLn stderr
--- | Catch 'Ex.IOException's and convert them to the 'ExceptT' monad
-tryIO :: (MonadIO m) => IO a -> ExceptT Ex.IOException m a
-tryIO = ExceptT . liftIO . Ex.try
+-- | Catch 'IOException's and convert them to the 'ExceptT' monad
+tryIO :: MonadIO m => IO a -> ExceptT IOException m a
+tryIO = ExceptT . liftIO . Exception.try
{-| Catch all exceptions, except for asynchronous exceptions found in @base@
and convert them to the 'ExceptT' monad
-}
-syncIO :: MonadIO m => IO a -> ExceptT Ex.SomeException m a
-syncIO a = ExceptT . liftIO $ Ex.catches (Right <$> a)
- [ Ex.Handler $ \e -> Ex.throw (e :: Ex.ArithException)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.ArrayException)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.AssertionFailed)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.AsyncException)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.BlockedIndefinitelyOnMVar)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.BlockedIndefinitelyOnSTM)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.Deadlock)
- , Ex.Handler $ \e -> Ex.throw (e :: Dynamic)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.ErrorCall)
- , Ex.Handler $ \e -> Ex.throw (e :: ExitCode)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.NestedAtomically)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.NoMethodError)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.NonTermination)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.PatternMatchFail)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.RecConError)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.RecSelError)
- , Ex.Handler $ \e -> Ex.throw (e :: Ex.RecUpdError)
- , Ex.Handler $ return . Left
- ]
+syncIO :: Unexceptional m => IO a -> ExceptT SomeException m a
+syncIO = ExceptT . UIO.liftUIO . UIO.fromIO
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/errors-2.0.1/errors.cabal new/errors-2.1.1/errors.cabal
--- old/errors-2.0.1/errors.cabal 2015-09-15 20:38:27.000000000 +0200
+++ new/errors-2.1.1/errors.cabal 2016-01-16 23:09:57.000000000 +0100
@@ -1,5 +1,5 @@
Name: errors
-Version: 2.0.1
+Version: 2.1.1
Cabal-Version: >=1.8.0.2
Build-Type: Simple
License: BSD3
@@ -25,7 +25,8 @@
base >= 4 && < 5 ,
safe >= 0.3.3 && < 0.4,
transformers >= 0.2 && < 0.5,
- transformers-compat >= 0.4 && < 0.5
+ transformers-compat >= 0.4 && < 0.6,
+ unexceptionalio >= 0.3 && < 0.4
Exposed-Modules:
Control.Error,
Control.Error.Safe,
1
0
Hello community,
here is the log from the commit of package ghc-distributive for openSUSE:Factory checked in at 2016-01-28 17:23:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-distributive (Old)
and /work/SRC/openSUSE:Factory/.ghc-distributive.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-distributive"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-distributive/ghc-distributive.changes 2015-05-22 16:36:01.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-distributive.new/ghc-distributive.changes 2016-01-28 17:24:37.000000000 +0100
@@ -1,0 +2,8 @@
+Tue Jan 26 08:40:30 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 0.5.0.2
+* Added flags for removing some dependencies.
+* upport doctests when building to non-standard locations (such as when using stack.)
+* Support base-orphans
+
+-------------------------------------------------------------------
Old:
----
distributive-0.4.4.tar.gz
New:
----
distributive-0.5.0.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-distributive.spec ++++++
--- /var/tmp/diff_new_pack.iKKsux/_old 2016-01-28 17:24:38.000000000 +0100
+++ /var/tmp/diff_new_pack.iKKsux/_new 2016-01-28 17:24:38.000000000 +0100
@@ -21,7 +21,7 @@
%bcond_with tests
Name: ghc-distributive
-Version: 0.4.4
+Version: 0.5.0.2
Release: 0
Summary: Distributive functors -- Dual to Traversable
License: BSD-2-Clause
@@ -34,6 +34,7 @@
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-rpm-macros
# Begin cabal-rpm deps:
+BuildRequires: ghc-base-orphans-devel
BuildRequires: ghc-tagged-devel
BuildRequires: ghc-transformers-compat-devel
BuildRequires: ghc-transformers-devel
++++++ distributive-0.4.4.tar.gz -> distributive-0.5.0.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distributive-0.4.4/.ghci new/distributive-0.5.0.2/.ghci
--- old/distributive-0.4.4/.ghci 2014-05-05 22:51:17.000000000 +0200
+++ new/distributive-0.5.0.2/.ghci 1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-:set -isrc -idist/build/autogen -optP-include -optPdist/build/autogen/cabal_macros.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distributive-0.4.4/.travis.yml new/distributive-0.5.0.2/.travis.yml
--- old/distributive-0.4.4/.travis.yml 2014-05-05 22:51:17.000000000 +0200
+++ new/distributive-0.5.0.2/.travis.yml 2016-01-17 01:07:48.000000000 +0100
@@ -1,17 +1,118 @@
-language: haskell
-before_install:
- # Uncomment whenever hackage is down.
- # - mkdir -p ~/.cabal && cp config ~/.cabal/config && cabal update
+# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
+language: c
+sudo: false
+
+cache:
+ directories:
+ - $HOME/.cabsnap
+ - $HOME/.cabal/packages
+ - $HOME/.stack
+
+before_cache:
+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
+
+matrix:
+ include:
+ - env: CABALVER=1.18 GHCVER=7.4.2 BUILD=cabal
+ compiler: ": #GHC 7.4.2"
+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.4.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+
+ - env: CABALVER=1.18 GHCVER=7.6.3 BUILD=cabal
+ compiler: ": #GHC 7.6.3"
+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+
+ - env: CABALVER=1.18 GHCVER=7.8.4 BUILD=cabal
+ compiler: ": #GHC 7.8.4"
+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+
+# - env: BUILD=stack STACK_YAML=stack-7.8.yaml STACK_OPTIONS=--skip-ghc-check
+# addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+
+# - env: BUILD=stack STACK_YAML=stack-7.8.yaml
+# os: osx
- # Try installing some of the build-deps with apt-get for speed.
- - ./travis-cabal-apt-install --only-dependencies --force-reinstall $mode
+ - env: CABALVER=1.22 GHCVER=7.10.1 BUILD=cabal
+ compiler: ": #GHC 7.10.1"
+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+ - env: CABALVER=1.22 GHCVER=7.10.2 BUILD=cabal
+ compiler: ": #GHC 7.10.2"
+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+
+ - env: BUILD=stack STACK_OPTIONS=--skip-ghc-check
+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}
+
+ - env: BUILD=stack
+ os: osx
+
+
+before_install:
+ - unset CC
+ - case "$BUILD" in
+ stack)
+ export STACK_VERSION=0.1.3.0;
+ export PATH=~/bin:$PATH;
+ mkdir -p ~/bin;
+ travis_retry curl -L https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSIO… | gunzip > ~/bin/stack;
+ chmod a+x ~/bin/stack;
+ scripts/travis_long stack --no-terminal setup;;
+ cabal)
+ export HAPPYVER=1.19.5
+ export ALEXVER=3.1.4
+ export PATH=~/.cabal/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/happy/$HAPPYVER/bin:/opt/alex/$ALEXVER/bin:$PATH;;
+ esac
install:
- - cabal configure -flib-Werror $mode
- - cabal build
+ - case "$BUILD" in
+ stack)
+ scripts/travis_long stack --no-terminal $STACK_OPTIONS build --only-snapshot -j2;;
+ cabal)
+ echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
+ cabal --version;
+ if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
+ then
+ zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
+ $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
+ fi;
+ travis_retry cabal update;
+ cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt;
+ sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt;
+ if diff -u installplan.txt $HOME/.cabsnap/installplan.txt; then
+ echo "cabal build-cache HIT";
+ rm -rfv .ghc;
+ cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
+ cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
+ else
+ echo "cabal build-cache MISS";
+ rm -rf $HOME/.cabsnap;
+ mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
+ cabal install --only-dependencies --enable-tests --enable-benchmarks;
+ if [ "$GHCVER" = "7.10.1" ]; then cabal install Cabal-1.22.4.0; fi;
+ fi;
+ if [ ! -d $HOME/.cabsnap ]; then
+ echo "snapshotting package-db to build-cache";
+ mkdir $HOME/.cabsnap;
+ cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
+ cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
+ fi;;
+ esac
+
+# snapshot package-db on cache miss
+# Here starts the actual work to be performed for the package under test;
+# any command which exits with a non-zero exit code causes the build to fail.
script:
- - $script
+ - case "$BUILD" in
+ stack)
+ scripts/travis_long stack --no-terminal $STACK_OPTIONS build -j2;;
+ cabal)
+ cabal configure --enable-tests -v2;
+ cabal build;
+ cabal test;
+ cabal bench || true;
+ cabal sdist || true;
+ SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && (cd dist && cabal install --force-reinstalls "$SRC_TGZ");;
+ esac
notifications:
irc:
@@ -19,7 +120,5 @@
- "irc.freenode.org#haskell-lens"
skip_join: true
template:
- - "\x0313distributive\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"
-
-env:
- - mode="--enable-tests" script="cabal test"
+ - "\x0313distributive\x0f/\x0306%{branch}\x0f \x0314%{commit}\x0f %{message} \x0302\x1f%{build_url}\x0f"
+# EOF
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distributive-0.4.4/CHANGELOG.markdown new/distributive-0.5.0.2/CHANGELOG.markdown
--- old/distributive-0.4.4/CHANGELOG.markdown 2014-05-05 22:51:17.000000000 +0200
+++ new/distributive-0.5.0.2/CHANGELOG.markdown 2016-01-17 01:07:48.000000000 +0100
@@ -1,3 +1,17 @@
+0.5.0.2
+-------
+* A more elegant fix for builds on GHC 7.2
+
+0.5.0.1
+-------
+* Fix builds on GHC 7.2
+
+0.5
+---
+* Added flags for removing some dependencies.
+* Support `doctests` when building to non-standard locations (such as when using `stack`.)
+* Support `base-orphans`
+
0.4.4
-----
* `transformers 0.4` compatibility
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distributive-0.4.4/LICENSE new/distributive-0.5.0.2/LICENSE
--- old/distributive-0.4.4/LICENSE 2014-05-05 22:51:17.000000000 +0200
+++ new/distributive-0.5.0.2/LICENSE 2016-01-17 01:07:48.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright 2011-2014 Edward Kmett
+Copyright 2011-2016 Edward Kmett
All rights reserved.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distributive-0.4.4/README.markdown new/distributive-0.5.0.2/README.markdown
--- old/distributive-0.4.4/README.markdown 2014-05-05 22:51:17.000000000 +0200
+++ new/distributive-0.5.0.2/README.markdown 2016-01-17 01:07:48.000000000 +0100
@@ -1,7 +1,7 @@
distributive
============
-[![Build Status](https://secure.travis-ci.org/ekmett/distributive.png?branch=master)…
+[![Hackage](https://img.shields.io/hackage/v/distributive.svg)](https://hackage.haskell.org/package/distributive) [![Build Status](https://secure.travis-ci.org/ekmett/distributive.png?branch=master)…
This package provides the notion that is categorically dual to `Traversable`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distributive-0.4.4/Setup.lhs new/distributive-0.5.0.2/Setup.lhs
--- old/distributive-0.4.4/Setup.lhs 2014-05-05 22:51:17.000000000 +0200
+++ new/distributive-0.5.0.2/Setup.lhs 2016-01-17 01:07:48.000000000 +0100
@@ -30,6 +30,10 @@
withTestLBI pkg lbi $ \suite suitecfg -> do
rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines
[ "module Build_" ++ testName suite ++ " where"
+ , ""
+ , "autogen_dir :: String"
+ , "autogen_dir = " ++ show dir
+ , ""
, "deps :: [String]"
, "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg))
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distributive-0.4.4/distributive.cabal new/distributive-0.5.0.2/distributive.cabal
--- old/distributive-0.4.4/distributive.cabal 2014-05-05 22:51:17.000000000 +0200
+++ new/distributive-0.5.0.2/distributive.cabal 2016-01-17 01:07:48.000000000 +0100
@@ -1,6 +1,6 @@
name: distributive
category: Data Structures
-version: 0.4.4
+version: 0.5.0.2
license: BSD3
cabal-version: >= 1.8
license-file: LICENSE
@@ -9,12 +9,11 @@
stability: provisional
homepage: http://github.com/ekmett/distributive/
bug-reports: http://github.com/ekmett/distributive/issues
-copyright: Copyright (C) 2011-2014 Edward A. Kmett
+copyright: Copyright (C) 2011-2016 Edward A. Kmett
synopsis: Distributive functors -- Dual to Traversable
description: Distributive functors -- Dual to Traversable
build-type: Custom
extra-source-files:
- .ghci
.travis.yml
.vim.custom
config
@@ -26,15 +25,19 @@
type: git
location: git://github.com/ekmett/distributive.git
-flag lib-Werror
+flag tagged
manual: True
- default: False
+ default: True
+ description:
+ You can disable the use of the `tagged` package using `-f-tagged`.
+ .
+ Disabling this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users.
library
build-depends:
base >= 4 && < 5,
- tagged >= 0.7 && < 1,
- transformers >= 0.2 && < 0.5,
+ base-orphans >= 0.5 && < 1,
+ transformers >= 0.2 && < 0.6,
transformers-compat >= 0.3 && < 1
hs-source-dirs: src
@@ -43,12 +46,14 @@
if impl(ghc>=7.2)
exposed-modules: Data.Distributive.Generic
+
+ if flag(tagged)
+ build-depends: tagged >= 0.7 && < 1
+
+ if impl(ghc>=7.2 && < 7.6)
build-depends: ghc-prim
- if flag(lib-Werror)
- ghc-options: -Werror
- else
- ghc-options: -Wall
+ ghc-options: -Wall
-- Verify the results of the examples
test-suite doctests
@@ -60,6 +65,4 @@
doctest >= 0.9.1,
filepath >= 1.2
ghc-options: -Wall -threaded
- if impl(ghc<7.6.1)
- ghc-options: -Werror
hs-source-dirs: tests
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distributive-0.4.4/src/Data/Distributive/Generic.hs new/distributive-0.5.0.2/src/Data/Distributive/Generic.hs
--- old/distributive-0.4.4/src/Data/Distributive/Generic.hs 2014-05-05 22:51:17.000000000 +0200
+++ new/distributive-0.5.0.2/src/Data/Distributive/Generic.hs 2016-01-17 01:07:48.000000000 +0100
@@ -4,7 +4,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Data.Distributive
--- Copyright : (C) 2011-2014 Edward Kmett
+-- Copyright : (C) 2011-2016 Edward Kmett
-- License : BSD-style (see the file LICENSE)
--
-- Maintainer : Edward Kmett <ekmett(a)gmail.com>
@@ -45,7 +45,7 @@
sndP (_ :*: r) = r
{-# INLINE gdistribute #-}
-instance (Functor a, Functor b, GDistributive a, GDistributive b) => GDistributive (a :.: b) where
+instance (Functor a, GDistributive a, GDistributive b) => GDistributive (a :.: b) where
gdistribute = Comp1 . fmap gdistribute . gdistribute . fmap unComp1
{-# INLINE gdistribute #-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distributive-0.4.4/src/Data/Distributive.hs new/distributive-0.5.0.2/src/Data/Distributive.hs
--- old/distributive-0.4.4/src/Data/Distributive.hs 2014-05-05 22:51:17.000000000 +0200
+++ new/distributive-0.5.0.2/src/Data/Distributive.hs 2016-01-17 01:07:48.000000000 +0100
@@ -3,7 +3,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Data.Distributive
--- Copyright : (C) 2011-2014 Edward Kmett
+-- Copyright : (C) 2011-2016 Edward Kmett
-- License : BSD-style (see the file LICENSE)
--
-- Maintainer : Edward Kmett <ekmett(a)gmail.com>
@@ -29,8 +29,18 @@
import Data.Functor.Identity
import Data.Functor.Product
import Data.Functor.Reverse
+import qualified Data.Monoid as Monoid
+import Data.Orphans ()
+
+#if MIN_VERSION_base(4,4,0)
+import Data.Complex
+#endif
+#if (defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707) || defined(MIN_VERSION_tagged)
import Data.Proxy
+#endif
+#ifdef MIN_VERSION_tagged
import Data.Tagged
+#endif
#ifdef HLINT
{-# ANN module "hlint: ignore Use section" #-}
@@ -125,3 +135,24 @@
instance Distributive f => Distributive (Reverse f) where
distribute = Reverse . collect getReverse
+
+instance Distributive Monoid.Dual where
+ collect f = Monoid.Dual . fmap (Monoid.getDual . f)
+ distribute = Monoid.Dual . fmap Monoid.getDual
+
+instance Distributive Monoid.Product where
+ collect f = Monoid.Product . fmap (Monoid.getProduct . f)
+ distribute = Monoid.Product . fmap Monoid.getProduct
+
+instance Distributive Monoid.Sum where
+ collect f = Monoid.Sum . fmap (Monoid.getSum . f)
+ distribute = Monoid.Sum . fmap Monoid.getSum
+
+#if MIN_VERSION_base(4,4,0)
+instance Distributive Complex where
+ distribute wc = fmap realP wc :+ fmap imagP wc where
+ -- Redefine realPart and imagPart to avoid incurring redundant RealFloat
+ -- constraints on older versions of base
+ realP (r :+ _) = r
+ imagP (_ :+ i) = i
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/distributive-0.4.4/tests/doctests.hs new/distributive-0.5.0.2/tests/doctests.hs
--- old/distributive-0.4.4/tests/doctests.hs 2014-05-05 22:51:17.000000000 +0200
+++ new/distributive-0.5.0.2/tests/doctests.hs 2016-01-17 01:07:48.000000000 +0100
@@ -1,7 +1,10 @@
+{-# LANGUAGE CPP #-}
module Main where
-import Build_doctests (deps)
+import Build_doctests (autogen_dir, deps)
+#if __GLASGOW_HASKELL__ < 710
import Control.Applicative
+#endif
import Control.Monad
import Data.List
import System.Directory
@@ -11,9 +14,9 @@
main :: IO ()
main = getSources >>= \sources -> doctest $
"-isrc"
- : "-idist/build/autogen"
+ : ("-i" ++ autogen_dir)
: "-optP-include"
- : "-optPdist/build/autogen/cabal_macros.h"
+ : ("-optP" ++ autogen_dir ++ "/cabal_macros.h")
: "-hide-all-packages"
: map ("-package="++) deps ++ sources
1
0
Hello community,
here is the log from the commit of package ghc-contravariant for openSUSE:Factory checked in at 2016-01-28 17:23:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-contravariant (Old)
and /work/SRC/openSUSE:Factory/.ghc-contravariant.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-contravariant"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-contravariant/ghc-contravariant.changes 2015-09-17 09:19:15.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-contravariant.new/ghc-contravariant.changes 2016-01-28 17:24:36.000000000 +0100
@@ -1,0 +2,7 @@
+Fri Jan 22 08:35:07 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 1.4
+* Improved the performance of Deciding at the cost of downgrading it to Trustworthy.
+* Support for transformers 0.5
+
+-------------------------------------------------------------------
Old:
----
contravariant-1.3.3.tar.gz
New:
----
contravariant-1.4.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-contravariant.spec ++++++
--- /var/tmp/diff_new_pack.0aGwI2/_old 2016-01-28 17:24:37.000000000 +0100
+++ /var/tmp/diff_new_pack.0aGwI2/_new 2016-01-28 17:24:37.000000000 +0100
@@ -19,7 +19,7 @@
%global pkg_name contravariant
Name: ghc-contravariant
-Version: 1.3.3
+Version: 1.4
Release: 0
Summary: Contravariant functors
License: BSD-3-Clause
@@ -34,6 +34,7 @@
# Begin cabal-rpm deps:
BuildRequires: ghc-StateVar-devel
BuildRequires: ghc-semigroups-devel
+BuildRequires: ghc-tagged-devel
BuildRequires: ghc-transformers-compat-devel
BuildRequires: ghc-transformers-devel
BuildRequires: ghc-void-devel
++++++ contravariant-1.3.3.tar.gz -> contravariant-1.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contravariant-1.3.3/CHANGELOG.markdown new/contravariant-1.4/CHANGELOG.markdown
--- old/contravariant-1.3.3/CHANGELOG.markdown 2015-09-04 12:33:20.000000000 +0200
+++ new/contravariant-1.4/CHANGELOG.markdown 2016-01-16 22:55:58.000000000 +0100
@@ -1,3 +1,9 @@
+1.4
+---
+* Improved the performance of `Deciding` at the cost of downgrading it to `Trustworthy`.
+* Support for GHC 8
+* Support for `transformers` 0.5
+
1.3.3
-----
* Add `instance Monoid m => Divisible (Const m)`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contravariant-1.3.3/contravariant.cabal new/contravariant-1.4/contravariant.cabal
--- old/contravariant-1.3.3/contravariant.cabal 2015-09-04 12:33:20.000000000 +0200
+++ new/contravariant-1.4/contravariant.cabal 2016-01-16 22:55:58.000000000 +0100
@@ -1,6 +1,6 @@
name: contravariant
category: Control, Data
-version: 1.3.3
+version: 1.4
license: BSD3
cabal-version: >= 1.6
license-file: LICENSE
@@ -38,6 +38,11 @@
default: True
manual: True
+flag safe
+ description: Get Safe guarantees rather than merely Trustworthy, but with worse constant factors.
+ default: False
+ manual: True
+
flag StateVar
description:
You can disable the use of the `StateVar` package using `-f-StateVar`.
@@ -50,7 +55,7 @@
hs-source-dirs: src
build-depends:
base < 5,
- transformers >= 0.2 && < 0.5,
+ transformers >= 0.2 && < 0.6,
transformers-compat >= 0.3 && < 1,
void >= 0.6 && < 1
@@ -66,6 +71,9 @@
if impl(ghc >= 7.2 && < 7.6)
build-depends: ghc-prim
+ if flag(safe)
+ cpp-options: -DSAFE
+
exposed-modules:
Data.Functor.Contravariant
Data.Functor.Contravariant.Compose
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contravariant-1.3.3/src/Data/Functor/Contravariant/Divisible.hs new/contravariant-1.4/src/Data/Functor/Contravariant/Divisible.hs
--- old/contravariant-1.3.3/src/Data/Functor/Contravariant/Divisible.hs 2015-09-04 12:33:20.000000000 +0200
+++ new/contravariant-1.4/src/Data/Functor/Contravariant/Divisible.hs 2016-01-16 22:55:58.000000000 +0100
@@ -1,4 +1,7 @@
{-# LANGUAGE CPP #-}
+{-# LANGUAGE TypeOperators #-}
+{-# OPTIONS_GHC -fno-warn-deprecations #-}
+
-----------------------------------------------------------------------------
-- |
-- Module : Data.Functor.Contravariant.Divisible
@@ -20,18 +23,48 @@
) where
import Control.Applicative
+import Control.Applicative.Backwards
+import Control.Arrow
+import Control.Monad.Trans.Error
+import Control.Monad.Trans.Except
+import Control.Monad.Trans.Identity
+import Control.Monad.Trans.List
+import Control.Monad.Trans.Maybe
+import qualified Control.Monad.Trans.RWS.Lazy as Lazy
+import qualified Control.Monad.Trans.RWS.Strict as Strict
+import Control.Monad.Trans.Reader
+import qualified Control.Monad.Trans.State.Lazy as Lazy
+import qualified Control.Monad.Trans.State.Strict as Strict
+import qualified Control.Monad.Trans.Writer.Lazy as Lazy
+import qualified Control.Monad.Trans.Writer.Strict as Strict
+
+import Data.Either
+import Data.Functor.Compose
+import Data.Functor.Constant
import Data.Functor.Contravariant
+import Data.Functor.Product
+import Data.Functor.Reverse
+import Data.Void
-#if __GLASGOW_HASKELL__ < 710
-import Data.Monoid
+#if MIN_VERSION_base(4,8,0)
+import Data.Monoid (Alt(..))
+#else
+import Data.Monoid (Monoid(..))
#endif
-import Data.Void
+#if MIN_VERSION_base(4,7,0) || defined(MIN_VERSION_tagged)
+import Data.Proxy
+#endif
#if MIN_VERSION_StateVar
import Data.StateVar
#endif
+#if __GLASGOW_HASKELL__ >= 702
+#define GHC_GENERICS
+import GHC.Generics
+#endif
+
--------------------------------------------------------------------------------
-- * Contravariant Applicative
--------------------------------------------------------------------------------
@@ -53,7 +86,7 @@
-- @
-- delta a = (a,a)
-- @
---
+--
-- @'divide' 'delta'@ should be associative with 'conquer' as a unit
--
-- @
@@ -94,7 +127,7 @@
-- | Redundant, but provided for symmetry.
--
-- @
--- 'conquered' = 'conquer
+-- 'conquered' = 'conquer'
-- @
conquered :: Divisible f => f ()
conquered = conquer
@@ -108,7 +141,7 @@
-- @
liftD :: Divisible f => (a -> b) -> f b -> f a
liftD f = divide ((,) () . f) conquer
-
+
instance Monoid r => Divisible (Op r) where
divide f (Op g) (Op h) = Op $ \a -> case f a of
(b, c) -> g b `mappend` h c
@@ -135,6 +168,118 @@
divide _ (Const a) (Const b) = Const (mappend a b)
conquer = Const mempty
+#if MIN_VERSION_base(4,8,0)
+instance Divisible f => Divisible (Alt f) where
+ divide f (Alt l) (Alt r) = Alt $ divide f l r
+ conquer = Alt conquer
+#endif
+
+#ifdef GHC_GENERICS
+instance Divisible U1 where
+ divide _ U1 U1 = U1
+ conquer = U1
+
+instance Divisible f => Divisible (Rec1 f) where
+ divide f (Rec1 l) (Rec1 r) = Rec1 $ divide f l r
+ conquer = Rec1 conquer
+
+instance Divisible f => Divisible (M1 i c f) where
+ divide f (M1 l) (M1 r) = M1 $ divide f l r
+ conquer = M1 conquer
+
+instance (Divisible f, Divisible g) => Divisible (f :*: g) where
+ divide f (l1 :*: r1) (l2 :*: r2) = divide f l1 l2 :*: divide f r1 r2
+ conquer = conquer :*: conquer
+
+instance (Applicative f, Divisible g) => Divisible (f :.: g) where
+ divide f (Comp1 l) (Comp1 r) = Comp1 (divide f <$> l <*> r)
+ conquer = Comp1 $ pure conquer
+#endif
+
+instance Divisible f => Divisible (Backwards f) where
+ divide f (Backwards l) (Backwards r) = Backwards $ divide f l r
+ conquer = Backwards conquer
+
+instance Divisible m => Divisible (ErrorT e m) where
+ divide f (ErrorT l) (ErrorT r) = ErrorT $ divide (funzip . fmap f) l r
+ conquer = ErrorT conquer
+
+instance Divisible m => Divisible (ExceptT e m) where
+ divide f (ExceptT l) (ExceptT r) = ExceptT $ divide (funzip . fmap f) l r
+ conquer = ExceptT conquer
+
+instance Divisible f => Divisible (IdentityT f) where
+ divide f (IdentityT l) (IdentityT r) = IdentityT $ divide f l r
+ conquer = IdentityT conquer
+
+instance Divisible m => Divisible (ListT m) where
+ divide f (ListT l) (ListT r) = ListT $ divide (funzip . map f) l r
+ conquer = ListT conquer
+
+instance Divisible m => Divisible (MaybeT m) where
+ divide f (MaybeT l) (MaybeT r) = MaybeT $ divide (funzip . fmap f) l r
+ conquer = MaybeT conquer
+
+instance Divisible m => Divisible (ReaderT r m) where
+ divide abc (ReaderT rmb) (ReaderT rmc) = ReaderT $ \r -> divide abc (rmb r) (rmc r)
+ conquer = ReaderT $ \_ -> conquer
+
+instance Divisible m => Divisible (Lazy.RWST r w s m) where
+ divide abc (Lazy.RWST rsmb) (Lazy.RWST rsmc) = Lazy.RWST $ \r s ->
+ divide (\ ~(a, s', w) -> case abc a of
+ ~(b, c) -> ((b, s', w), (c, s', w)))
+ (rsmb r s) (rsmc r s)
+ conquer = Lazy.RWST $ \_ _ -> conquer
+
+instance Divisible m => Divisible (Strict.RWST r w s m) where
+ divide abc (Strict.RWST rsmb) (Strict.RWST rsmc) = Strict.RWST $ \r s ->
+ divide (\(a, s', w) -> case abc a of
+ (b, c) -> ((b, s', w), (c, s', w)))
+ (rsmb r s) (rsmc r s)
+ conquer = Strict.RWST $ \_ _ -> conquer
+
+instance Divisible m => Divisible (Lazy.StateT s m) where
+ divide f (Lazy.StateT l) (Lazy.StateT r) = Lazy.StateT $ \s ->
+ divide (lazyFanout f) (l s) (r s)
+ conquer = Lazy.StateT $ \_ -> conquer
+
+instance Divisible m => Divisible (Strict.StateT s m) where
+ divide f (Strict.StateT l) (Strict.StateT r) = Strict.StateT $ \s ->
+ divide (strictFanout f) (l s) (r s)
+ conquer = Strict.StateT $ \_ -> conquer
+
+instance Divisible m => Divisible (Lazy.WriterT w m) where
+ divide f (Lazy.WriterT l) (Lazy.WriterT r) = Lazy.WriterT $
+ divide (lazyFanout f) l r
+ conquer = Lazy.WriterT conquer
+
+instance Divisible m => Divisible (Strict.WriterT w m) where
+ divide f (Strict.WriterT l) (Strict.WriterT r) = Strict.WriterT $
+ divide (strictFanout f) l r
+ conquer = Strict.WriterT conquer
+
+instance (Applicative f, Divisible g) => Divisible (Compose f g) where
+ divide f (Compose l) (Compose r) = Compose (divide f <$> l <*> r)
+ conquer = Compose $ pure conquer
+
+instance Monoid m => Divisible (Constant m) where
+ divide _ (Constant l) (Constant r) = Constant $ mappend l r
+ conquer = Constant mempty
+
+instance (Divisible f, Divisible g) => Divisible (Product f g) where
+ divide f (Pair l1 r1) (Pair l2 r2) = Pair (divide f l1 l2) (divide f r1 r2)
+ conquer = Pair conquer conquer
+
+instance Divisible f => Divisible (Reverse f) where
+ divide f (Reverse l) (Reverse r) = Reverse $ divide f l r
+ conquer = Reverse conquer
+
+#if MIN_VERSION_base(4,7,0) || defined(MIN_VERSION_tagged)
+instance Divisible Proxy where
+ divide _ Proxy Proxy = Proxy
+ conquer = Proxy
+#endif
+
#if MIN_VERSION_StateVar
instance Divisible SettableStateVar where
divide k (SettableStateVar l) (SettableStateVar r) = SettableStateVar $ \ a -> case k a of
@@ -142,13 +287,24 @@
conquer = SettableStateVar $ \_ -> return ()
#endif
+lazyFanout :: (a -> (b, c)) -> (a, s) -> ((b, s), (c, s))
+lazyFanout f ~(a, s) = case f a of
+ ~(b, c) -> ((b, s), (c, s))
+
+strictFanout :: (a -> (b, c)) -> (a, s) -> ((b, s), (c, s))
+strictFanout f (a, s) = case f a of
+ (b, c) -> ((b, s), (c, s))
+
+funzip :: Functor f => f (a, b) -> (f a, f b)
+funzip = fmap fst &&& fmap snd
+
--------------------------------------------------------------------------------
-- * Contravariant Alternative
--------------------------------------------------------------------------------
-- |
--
--- A 'Divisible' contravariant functor is a monoid object in the category of presheaves
+-- A 'Divisible' contravariant functor is a monoid object in the category of presheaves
-- from Hask to Hask, equipped with Day convolution mapping the cartesian product of the
-- source to the Cartesian product of the target.
--
@@ -210,6 +366,123 @@
lose f = Op $ absurd . f
choose f (Op g) (Op h) = Op $ either g h . f
+#if MIN_VERSION_base(4,8,0)
+instance Decidable f => Decidable (Alt f) where
+ lose = Alt . lose
+ choose f (Alt l) (Alt r) = Alt $ choose f l r
+#endif
+
+#ifdef GHC_GENERICS
+instance Decidable U1 where
+ lose _ = U1
+ choose _ U1 U1 = U1
+
+instance Decidable f => Decidable (Rec1 f) where
+ lose = Rec1 . lose
+ choose f (Rec1 l) (Rec1 r) = Rec1 $ choose f l r
+
+instance Decidable f => Decidable (M1 i c f) where
+ lose = M1 . lose
+ choose f (M1 l) (M1 r) = M1 $ choose f l r
+
+instance (Decidable f, Decidable g) => Decidable (f :*: g) where
+ lose f = lose f :*: lose f
+ choose f (l1 :*: r1) (l2 :*: r2) = choose f l1 l2 :*: choose f r1 r2
+
+instance (Applicative f, Decidable g) => Decidable (f :.: g) where
+ lose = Comp1 . pure . lose
+ choose f (Comp1 l) (Comp1 r) = Comp1 (choose f <$> l <*> r)
+#endif
+
+instance Decidable f => Decidable (Backwards f) where
+ lose = Backwards . lose
+ choose f (Backwards l) (Backwards r) = Backwards $ choose f l r
+
+instance Decidable f => Decidable (IdentityT f) where
+ lose = IdentityT . lose
+ choose f (IdentityT l) (IdentityT r) = IdentityT $ choose f l r
+
+instance Decidable m => Decidable (ReaderT r m) where
+ lose f = ReaderT $ \_ -> lose f
+ choose abc (ReaderT rmb) (ReaderT rmc) = ReaderT $ \r -> choose abc (rmb r) (rmc r)
+
+instance Decidable m => Decidable (Lazy.RWST r w s m) where
+ lose f = Lazy.RWST $ \_ _ -> contramap (\ ~(a, _, _) -> a) (lose f)
+ choose abc (Lazy.RWST rsmb) (Lazy.RWST rsmc) = Lazy.RWST $ \r s ->
+ choose (\ ~(a, s', w) -> either (Left . betuple3 s' w)
+ (Right . betuple3 s' w)
+ (abc a))
+ (rsmb r s) (rsmc r s)
+
+instance Decidable m => Decidable (Strict.RWST r w s m) where
+ lose f = Strict.RWST $ \_ _ -> contramap (\(a, _, _) -> a) (lose f)
+ choose abc (Strict.RWST rsmb) (Strict.RWST rsmc) = Strict.RWST $ \r s ->
+ choose (\(a, s', w) -> either (Left . betuple3 s' w)
+ (Right . betuple3 s' w)
+ (abc a))
+ (rsmb r s) (rsmc r s)
+
+instance Divisible m => Decidable (ListT m) where
+ lose _ = ListT conquer
+ choose f (ListT l) (ListT r) = ListT $ divide ((lefts &&& rights) . map f) l r
+
+instance Divisible m => Decidable (MaybeT m) where
+ lose _ = MaybeT conquer
+ choose f (MaybeT l) (MaybeT r) = MaybeT $
+ divide ( maybe (Nothing, Nothing)
+ (either (\b -> (Just b, Nothing))
+ (\c -> (Nothing, Just c)))
+ . fmap f) l r
+
+instance Decidable m => Decidable (Lazy.StateT s m) where
+ lose f = Lazy.StateT $ \_ -> contramap lazyFst (lose f)
+ choose f (Lazy.StateT l) (Lazy.StateT r) = Lazy.StateT $ \s ->
+ choose (\ ~(a, s') -> either (Left . betuple s') (Right . betuple s') (f a))
+ (l s) (r s)
+
+instance Decidable m => Decidable (Strict.StateT s m) where
+ lose f = Strict.StateT $ \_ -> contramap fst (lose f)
+ choose f (Strict.StateT l) (Strict.StateT r) = Strict.StateT $ \s ->
+ choose (\(a, s') -> either (Left . betuple s') (Right . betuple s') (f a))
+ (l s) (r s)
+
+instance Decidable m => Decidable (Lazy.WriterT w m) where
+ lose f = Lazy.WriterT $ contramap lazyFst (lose f)
+ choose f (Lazy.WriterT l) (Lazy.WriterT r) = Lazy.WriterT $
+ choose (\ ~(a, s') -> either (Left . betuple s') (Right . betuple s') (f a)) l r
+
+instance Decidable m => Decidable (Strict.WriterT w m) where
+ lose f = Strict.WriterT $ contramap fst (lose f)
+ choose f (Strict.WriterT l) (Strict.WriterT r) = Strict.WriterT $
+ choose (\(a, s') -> either (Left . betuple s') (Right . betuple s') (f a)) l r
+
+instance (Applicative f, Decidable g) => Decidable (Compose f g) where
+ lose = Compose . pure . lose
+ choose f (Compose l) (Compose r) = Compose (choose f <$> l <*> r)
+
+instance (Decidable f, Decidable g) => Decidable (Product f g) where
+ lose f = Pair (lose f) (lose f)
+ choose f (Pair l1 r1) (Pair l2 r2) = Pair (choose f l1 l2) (choose f r1 r2)
+
+instance Decidable f => Decidable (Reverse f) where
+ lose = Reverse . lose
+ choose f (Reverse l) (Reverse r) = Reverse $ choose f l r
+
+betuple :: s -> a -> (a, s)
+betuple s a = (a, s)
+
+betuple3 :: s -> w -> a -> (a, s, w)
+betuple3 s w a = (a, s, w)
+
+lazyFst :: (a, b) -> a
+lazyFst ~(a, _) = a
+
+#if MIN_VERSION_base(4,7,0) || defined(MIN_VERSION_tagged)
+instance Decidable Proxy where
+ lose _ = Proxy
+ choose _ Proxy Proxy = Proxy
+#endif
+
#if MIN_VERSION_StateVar
instance Decidable SettableVar where
lose k = SettableStateVar (absurd . k)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/contravariant-1.3.3/src/Data/Functor/Contravariant/Generic.hs new/contravariant-1.4/src/Data/Functor/Contravariant/Generic.hs
--- old/contravariant-1.3.3/src/Data/Functor/Contravariant/Generic.hs 2015-09-04 12:33:20.000000000 +0200
+++ new/contravariant-1.4/src/Data/Functor/Contravariant/Generic.hs 2016-01-16 22:55:58.000000000 +0100
@@ -1,5 +1,9 @@
{-# LANGUAGE CPP #-}
+#ifdef SAFE
{-# LANGUAGE BangPatterns #-}
+#elif __GLASGOW_HASKELL__ >= 704
+{-# LANGUAGE Trustworthy #-}
+#endif
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleInstances #-}
@@ -32,6 +36,9 @@
import Data.Functor.Contravariant
import Data.Functor.Contravariant.Divisible
import GHC.Generics
+#ifndef SAFE
+import Unsafe.Coerce
+#endif
-- | This provides machinery for deconstructing an arbitrary 'Generic' instance using a 'Decidable' 'Contravariant' functor.
--
@@ -84,13 +91,13 @@
gdeciding _ _ = conquer
instance GDeciding q V1 where
- gdeciding _ _ = lose (\ !_ -> error "impossible")
+ gdeciding _ _ = glose
instance (GDeciding q f, GDeciding q g) => GDeciding q (f :*: g) where
- gdeciding p q = divide (\(a :*: b) -> (a, b)) (gdeciding p q) (gdeciding p q)
+ gdeciding p q = gdivide (gdeciding p q) (gdeciding p q)
instance (GDeciding q f, GDeciding q g) => GDeciding q (f :+: g) where
- gdeciding p q = choose (\ xs -> case xs of L1 a -> Left a; R1 a -> Right a) (gdeciding p q) (gdeciding p q)
+ gdeciding p q = gchoose (gdeciding p q) (gdeciding p q)
#ifndef HLINT
instance q p => GDeciding q (K1 i p) where
@@ -109,18 +116,44 @@
gdeciding1 _ _ _ = conquer
instance GDeciding1 q V1 where
- gdeciding1 _ _ _ = lose (\ !_ -> error "impossible")
+ gdeciding1 _ _ _ = glose
instance (GDeciding1 q f, GDeciding1 q g) => GDeciding1 q (f :*: g) where
- gdeciding1 p q r = divide (\(a :*: b) -> (a, b)) (gdeciding1 p q r) (gdeciding1 p q r)
+ gdeciding1 p q r = gdivide (gdeciding1 p q r) (gdeciding1 p q r)
instance (GDeciding1 q f, GDeciding1 q g) => GDeciding1 q (f :+: g) where
- gdeciding1 p q r = choose (\ xs -> case xs of L1 a -> Left a; R1 a -> Right a) (gdeciding1 p q r) (gdeciding1 p q r)
+ gdeciding1 p q r = gchoose (gdeciding1 p q r) (gdeciding1 p q r)
+
+
+
+glose :: Decidable f => f (V1 a)
+#ifdef SAFE
+glose = lose (\ !_ -> error "impossible")
+#else
+glose = lose unsafeCoerce
+#endif
+{-# INLINE glose #-}
+
+gdivide :: Divisible f => f (g a) -> f (h a) -> f ((g:*:h) a)
+#ifdef SAFE
+gdivide = divide (\(f:*:g) -> (f,g))
+#else
+gdivide = divide unsafeCoerce
+#endif
+{-# INLINE gdivide #-}
+
+gchoose :: Decidable f => f (g a) -> f (h a) -> f ((g:+:h) a)
+#ifdef SAFE
+gchoose = choose (\xs -> case xs of L1 a -> Left a; R1 b -> Right b)
+#else
+gchoose = choose unsafeCoerce
+#endif
+{-# INLINE gchoose #-}
#ifndef HLINT
instance q p => GDeciding1 q (K1 i p) where
-#endif
gdeciding1 _ q _ = contramap unK1 q
+#endif
instance GDeciding1 q f => GDeciding1 q (M1 i c f) where
gdeciding1 p q r = contramap unM1 (gdeciding1 p q r)
1
0
Hello community,
here is the log from the commit of package ghc-constraints for openSUSE:Factory checked in at 2016-01-28 17:23:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-constraints (Old)
and /work/SRC/openSUSE:Factory/.ghc-constraints.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-constraints"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-constraints/ghc-constraints.changes 2016-01-08 15:23:17.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-constraints.new/ghc-constraints.changes 2016-01-28 17:24:35.000000000 +0100
@@ -1,0 +2,10 @@
+Wed Jan 20 09:03:54 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 0.8
+* Remove the need for closed type families from the new Forall.
+* Found a nicer encoding of the initial object in the category of constraints
+ using a nullary constraint.
+* binary 0.8 compatibility
+* transformers 0.5 compatibility
+
+-------------------------------------------------------------------
Old:
----
constraints-0.6.tar.gz
New:
----
constraints-0.8.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-constraints.spec ++++++
--- /var/tmp/diff_new_pack.DVAEXM/_old 2016-01-28 17:24:36.000000000 +0100
+++ /var/tmp/diff_new_pack.DVAEXM/_new 2016-01-28 17:24:36.000000000 +0100
@@ -19,7 +19,7 @@
%global pkg_name constraints
Name: ghc-constraints
-Version: 0.6
+Version: 0.8
Release: 0
Summary: Constraint manipulation
License: BSD-2-Clause
++++++ constraints-0.6.tar.gz -> constraints-0.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/constraints-0.6/constraints.cabal new/constraints-0.8/constraints.cabal
--- old/constraints-0.6/constraints.cabal 2015-11-10 14:16:35.000000000 +0100
+++ new/constraints-0.8/constraints.cabal 2016-01-17 03:10:38.000000000 +0100
@@ -1,6 +1,6 @@
name: constraints
category: Constraints
-version: 0.6
+version: 0.8
license: BSD3
cabal-version: >= 1.10
license-file: LICENSE
@@ -17,7 +17,7 @@
This package provides a vocabulary for working with them.
build-type: Simple
-tested-with: GHC == 7.8.3, GHC == 7.7.20131027, GHC == 7.7.20131025
+tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.1, GHC == 7.10.2
extra-source-files: README.markdown
source-repository head
@@ -41,26 +41,24 @@
GADTs
build-depends:
- base >= 4.6 && < 5,
- binary >= 0.7.3 && < 0.8,
+ base >= 4.7 && < 5,
+ binary >= 0.7.3 && < 0.9,
deepseq >= 1.3 && < 1.5,
ghc-prim,
hashable >= 1.2 && < 1.3,
mtl >= 2 && < 2.3,
- transformers >= 0.2 && < 0.5,
+ transformers >= 0.2 && < 0.6,
transformers-compat >= 0.4 && < 1
if impl(ghc < 7.8)
build-depends:
newtype >= 0.2 && < 0.3,
tagged >= 0.2 && < 1
- else
- exposed-modules:
- Data.Constraint.Forall
exposed-modules:
Data.Constraint
Data.Constraint.Deferrable
+ Data.Constraint.Forall
Data.Constraint.Lifting
Data.Constraint.Unsafe
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/constraints-0.6/src/Data/Constraint/Forall.hs new/constraints-0.8/src/Data/Constraint/Forall.hs
--- old/constraints-0.6/src/Data/Constraint/Forall.hs 2015-11-10 14:16:35.000000000 +0100
+++ new/constraints-0.8/src/Data/Constraint/Forall.hs 2016-01-17 03:10:38.000000000 +0100
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
@@ -7,11 +8,14 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE PolyKinds #-}
+#if __GLASGOW_HASKELL__ >= 800
+{-# LANGUAGE UndecidableSuperClasses #-}
+#endif
-----------------------------------------------------------------------------
-- |
-- Module : Data.Constraint.Forall
-- Copyright : (C) 2011-2015 Edward Kmett,
--- (C) 2015 Ørjan Johansen,
+-- (C) 2015 Ørjan Johansen
-- License : BSD-style (see the file LICENSE)
--
-- Maintainer : Edward Kmett <ekmett(a)gmail.com>
@@ -95,22 +99,22 @@
-- which would be disastrous.
-- | A representation of the quantified constraint @forall a. p a@.
-type family Forall (p :: k -> Constraint) :: Constraint where
- Forall p = Forall_ p
+type family Forall (p :: k -> Constraint) :: Constraint
+type instance Forall p = Forall_ p
class p (Skolem p) => Forall_ (p :: k -> Constraint)
instance p (Skolem p) => Forall_ (p :: k -> Constraint)
-- | A representation of the quantified constraint @forall a. p (f a)@.
-type family ForallF (p :: k2 -> Constraint) (f :: k1 -> k2) :: Constraint where
- ForallF p f = ForallF_ p f
+type family ForallF (p :: k2 -> Constraint) (f :: k1 -> k2) :: Constraint
+type instance ForallF p f = ForallF_ p f
class p (f (SkolemF p f)) => ForallF_ (p :: k2 -> Constraint) (f :: k1 -> k2)
instance p (f (SkolemF p f)) => ForallF_ (p :: k2 -> Constraint) (f :: k1 -> k2)
type Forall1 p = Forall p
-- | A representation of the quantified constraint @forall f a. p (t f a)@.
-type family ForallT (p :: k3 -> Constraint) (t :: k1 -> k2 -> k3) :: Constraint where
- ForallT p t = ForallT_ p t
+type family ForallT (p :: k3 -> Constraint) (t :: k1 -> k2 -> k3) :: Constraint
+type instance ForallT p t = ForallT_ p t
class p (t (SkolemT1 p t) (SkolemT2 p t)) => ForallT_ (p :: k3 -> Constraint) (t :: k1 -> k2 -> k3)
instance p (t (SkolemT1 p t) (SkolemT2 p t)) => ForallT_ (p :: k3 -> Constraint) (t :: k1 -> k2 -> k3)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/constraints-0.6/src/Data/Constraint/Lifting.hs new/constraints-0.8/src/Data/Constraint/Lifting.hs
--- old/constraints-0.6/src/Data/Constraint/Lifting.hs 2015-11-10 14:16:35.000000000 +0100
+++ new/constraints-0.8/src/Data/Constraint/Lifting.hs 2016-01-17 03:10:38.000000000 +0100
@@ -112,6 +112,17 @@
instance Traversable f => Lifting Traversable (Compose f) where lifting = Sub Dict
instance Applicative f => Lifting Applicative (Compose f) where lifting = Sub Dict
instance Alternative f => Lifting Alternative (Compose f) where lifting = Sub Dict -- overconstrained
+
+#if MIN_VERSION_transformers(0,5,0)
+instance Show1 f => Lifting Show1 (Compose f) where lifting = Sub Dict
+instance Eq1 f => Lifting Eq1 (Compose f) where lifting = Sub Dict
+instance Ord1 f => Lifting Ord1 (Compose f) where lifting = Sub Dict
+instance Read1 f => Lifting Read1 (Compose f) where lifting = Sub Dict
+instance (Eq1 f, Eq1 g) => Lifting Eq (Compose f g) where lifting = Sub Dict
+instance (Ord1 f, Ord1 g) => Lifting Ord (Compose f g) where lifting = Sub Dict
+instance (Read1 f, Read1 g) => Lifting Read (Compose f g) where lifting = Sub Dict
+instance (Show1 f, Show1 g) => Lifting Show (Compose f g) where lifting = Sub Dict
+#else
instance (Functor f, Show1 f) => Lifting Show1 (Compose f) where lifting = Sub Dict
instance (Functor f, Eq1 f) => Lifting Eq1 (Compose f) where lifting = Sub Dict
instance (Functor f, Ord1 f) => Lifting Ord1 (Compose f) where lifting = Sub Dict
@@ -120,6 +131,7 @@
instance (Functor f, Ord1 f, Ord1 g) => Lifting Ord (Compose f g) where lifting = Sub Dict
instance (Functor f, Read1 f, Read1 g) => Lifting Read (Compose f g) where lifting = Sub Dict
instance (Functor f, Show1 f, Show1 g) => Lifting Show (Compose f g) where lifting = Sub Dict
+#endif
instance Functor f => Lifting Functor (Functor.Product f) where lifting = Sub Dict
instance Foldable f => Lifting Foldable (Functor.Product f) where lifting = Sub Dict
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/constraints-0.6/src/Data/Constraint/Unsafe.hs new/constraints-0.8/src/Data/Constraint/Unsafe.hs
--- old/constraints-0.6/src/Data/Constraint/Unsafe.hs 2015-11-10 14:16:35.000000000 +0100
+++ new/constraints-0.8/src/Data/Constraint/Unsafe.hs 2016-01-17 03:10:38.000000000 +0100
@@ -6,6 +6,9 @@
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE Unsafe #-}
+#if __GLASGOW_HASKELL__ >= 800
+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
+#endif
-----------------------------------------------------------------------------
-- |
-- Module : Data.Constraint.Unsafe
@@ -56,10 +59,19 @@
unsafeUnderive :: Coercible n o => (o -> n) -> t n :- t o
unsafeUnderive _ = unsafeCoerceConstraint
+
-- | Construct an Applicative instance from a Monad
unsafeApplicative :: forall m a. Monad m => (Applicative m => m a) -> m a
+#if __GLASGOW_HASKELL__ < 710
unsafeApplicative m = m \\ trans (unsafeCoerceConstraint :: Applicative (WrappedMonad m) :- Applicative m) ins
+#else
+unsafeApplicative m = m
+#endif
-- | Construct an Alternative instance from a MonadPlus
unsafeAlternative :: forall m a. MonadPlus m => (Alternative m => m a) -> m a
+#if __GLASGOW_HASKELL__ < 710
unsafeAlternative m = m \\ trans (unsafeCoerceConstraint :: Alternative (WrappedMonad m) :- Alternative m) ins
+#else
+unsafeAlternative m = m
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/constraints-0.6/src/Data/Constraint.hs new/constraints-0.8/src/Data/Constraint.hs
--- old/constraints-0.6/src/Data/Constraint.hs 2015-11-10 14:16:35.000000000 +0100
+++ new/constraints-0.8/src/Data/Constraint.hs 2016-01-17 03:10:38.000000000 +0100
@@ -18,6 +18,12 @@
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE RoleAnnotations #-}
#endif
+#if __GLASGOW_HASKELL__ >= 800
+{-# LANGUAGE UndecidableSuperClasses #-}
+#endif
+#if __GLASGOW_HASKELL__ >= 708 && __GLASGOW_HASKELL__ < 710
+{-# LANGUAGE NullaryTypeClasses #-}
+#endif
-----------------------------------------------------------------------------
-- |
-- Module : Data.Constraint
@@ -58,6 +64,7 @@
, weaken1, weaken2, contract
, (&&&), (***)
, trans, refl
+ , Bottom
, top, bottom
-- * Dict is fully faithful
, mapDict
@@ -79,7 +86,12 @@
#if __GLASGOW_HASKELL__ >= 707
import Data.Data
#endif
+#if __GLASGOW_HASKELL__ <= 710
import GHC.Prim (Constraint)
+#else
+import GHC.Types (Constraint)
+#endif
+import qualified GHC.Prim as Prim
-- | Values of type @'Dict' p@ capture a dictionary for a constraint of type @p@.
--
@@ -292,21 +304,14 @@
top :: a :- ()
top = Sub Dict
-type family Ex (a :: *) (c :: Constraint) :: Constraint
-type instance Ex () c = ()
-type instance Ex Bool c = c
-
-falso :: (() ~ a) :- Ex a c
-falso = Sub Dict
+-- | 'Any' inhabits every kind, including 'Constraint' but is uninhabited, making it impossible to define an instance.
+class Prim.Any => Bottom where
+ no :: Dict a
-- |
--- A bad type coercion lets you derive any constraint you want.
---
--- These are the initial arrows of the category and @(() ~ Bool)@ is the initial object
---
-- This demonstrates the law of classical logic <http://en.wikipedia.org/wiki/Principle_of_explosion "ex falso quodlibet">
-bottom :: (() ~ Bool) :- c
-bottom = falso
+bottom :: Bottom :- a
+bottom = Sub no
--------------------------------------------------------------------------------
-- Dict is fully faithful
@@ -375,7 +380,7 @@
instance Class () (b :=> a) where cls = Sub Dict
instance Class b a => () :=> Class b a where ins = Sub Dict
-instance (b :=> a) => () :=> b :=> a where ins = Sub Dict
+instance (b :=> a) => () :=> (b :=> a) where ins = Sub Dict
instance Class () () where cls = Sub Dict
instance () :=> () where ins = Sub Dict
1
0
Hello community,
here is the log from the commit of package ghc-cgi for openSUSE:Factory checked in at 2016-01-28 17:23:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-cgi (Old)
and /work/SRC/openSUSE:Factory/.ghc-cgi.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-cgi"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-cgi/ghc-cgi.changes 2015-08-25 10:08:45.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-cgi.new/ghc-cgi.changes 2016-01-28 17:24:34.000000000 +0100
@@ -1,0 +2,6 @@
+Fri Jan 22 08:00:11 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 3001.2.2.3
+* CGI.hs haddock: Use web.archive.org link for CGI specification
+
+-------------------------------------------------------------------
Old:
----
cgi-3001.2.2.2.tar.gz
New:
----
cgi-3001.2.2.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-cgi.spec ++++++
--- /var/tmp/diff_new_pack.4kBb5C/_old 2016-01-28 17:24:35.000000000 +0100
+++ /var/tmp/diff_new_pack.4kBb5C/_new 2016-01-28 17:24:35.000000000 +0100
@@ -18,7 +18,7 @@
%global pkg_name cgi
Name: ghc-cgi
-Version: 3001.2.2.2
+Version: 3001.2.2.3
Release: 0
Summary: A library for writing CGI programs
Group: System/Libraries
++++++ cgi-3001.2.2.2.tar.gz -> cgi-3001.2.2.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgi-3001.2.2.2/Network/CGI.hs new/cgi-3001.2.2.3/Network/CGI.hs
--- old/cgi-3001.2.2.2/Network/CGI.hs 2015-04-07 00:45:15.000000000 +0200
+++ new/cgi-3001.2.2.3/Network/CGI.hs 2016-01-20 08:43:22.000000000 +0100
@@ -13,7 +13,7 @@
-- Portability : non-portable (uses Control.Monad.State)
--
-- Simple Library for writing CGI programs.
--- See <http://hoohoo.ncsa.uiuc.edu/cgi/interface.html> for the
+-- See <https://web.archive.org/web/20100109233524/http://hoohoo.ncsa.illinois.edu/…> for the
-- CGI specification.
--
-- This version of the library is for systems with version 2.0 or greater
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgi-3001.2.2.2/cgi.cabal new/cgi-3001.2.2.3/cgi.cabal
--- old/cgi-3001.2.2.2/cgi.cabal 2015-04-07 00:45:15.000000000 +0200
+++ new/cgi-3001.2.2.3/cgi.cabal 2016-01-20 08:43:22.000000000 +0100
@@ -1,5 +1,5 @@
Name: cgi
-Version: 3001.2.2.2
+Version: 3001.2.2.3
Copyright: Bjorn Bringert, John Chee, Andy Gill, Anders Kaseorg,
Ian Lynagh, Erik Meijer, Sven Panne, Jeremy Shaw
Category: Network
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cgi-3001.2.2.2/changelog new/cgi-3001.2.2.3/changelog
--- old/cgi-3001.2.2.2/changelog 2015-04-07 00:45:15.000000000 +0200
+++ new/cgi-3001.2.2.3/changelog 2016-01-20 08:43:22.000000000 +0100
@@ -1,3 +1,13 @@
+3001.2.2.3
+
+### Changed
+* CGI.hs haddock: Use web.archive.org link for CGI specification
+
+3001.2.2.2
+
+### Changed
+* Added support for building with mtl < 2.2.1 via flags
+
3001.2.2.1
### Changed
1
0
Hello community,
here is the log from the commit of package ghc-cereal for openSUSE:Factory checked in at 2016-01-28 17:23:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-cereal (Old)
and /work/SRC/openSUSE:Factory/.ghc-cereal.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-cereal"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-cereal/ghc-cereal.changes 2015-05-21 08:36:46.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-cereal.new/ghc-cereal.changes 2016-01-28 17:24:33.000000000 +0100
@@ -1,0 +2,11 @@
+Tue Jan 26 08:30:51 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 0.5.1.0
+* Switch to using the builder provided by the ByteString package
+* Change the encoding of Float and Double with the Serialize class to use the
+ Data.Serialize.IEEE754 module
+* Add support for encoding and decoding ShortByteString
+* New and improved test suite thanks to Kei Hibino
+* Fix two bugs involving the lookAhead combinator and partial chunks.
+
+-------------------------------------------------------------------
Old:
----
cereal-0.4.1.1.tar.gz
New:
----
cereal-0.5.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-cereal.spec ++++++
--- /var/tmp/diff_new_pack.OwosoL/_old 2016-01-28 17:24:34.000000000 +0100
+++ /var/tmp/diff_new_pack.OwosoL/_new 2016-01-28 17:24:34.000000000 +0100
@@ -21,7 +21,7 @@
%global debug_package %{nil}
Name: ghc-cereal
-Version: 0.4.1.1
+Version: 0.5.1.0
Release: 0
Summary: A binary serialization library
License: BSD-3-Clause
++++++ cereal-0.4.1.1.tar.gz -> cereal-0.5.1.0.tar.gz ++++++
++++ 3518 lines of diff (skipped)
1
0
Hello community,
here is the log from the commit of package cabal-install for openSUSE:Factory checked in at 2016-01-28 17:23:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cabal-install (Old)
and /work/SRC/openSUSE:Factory/.cabal-install.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cabal-install"
Changes:
--------
--- /work/SRC/openSUSE:Factory/cabal-install/cabal-install.changes 2016-01-05 21:54:59.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.cabal-install.new/cabal-install.changes 2016-01-28 17:24:32.000000000 +0100
@@ -1,0 +2,5 @@
+Sun Jan 24 10:19:03 UTC 2016 - mimi.vx(a)gmail.com
+
+- relax HTTP dep
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ cabal-install.spec ++++++
--- /var/tmp/diff_new_pack.0WThy0/_old 2016-01-28 17:24:33.000000000 +0100
+++ /var/tmp/diff_new_pack.0WThy0/_new 2016-01-28 17:24:33.000000000 +0100
@@ -56,6 +56,7 @@
%prep
%setup -q
+cabal-tweak-dep-ver HTTP "< 4000.3" "< 4000.4"
%build
%ghc_bin_build
1
0
Hello community,
here is the log from the commit of package ghc-cabal-helper for openSUSE:Factory checked in at 2016-01-28 17:23:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-cabal-helper (Old)
and /work/SRC/openSUSE:Factory/.ghc-cabal-helper.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-cabal-helper"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-cabal-helper/ghc-cabal-helper.changes 2016-01-22 01:08:43.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-cabal-helper.new/ghc-cabal-helper.changes 2016-01-28 17:24:31.000000000 +0100
@@ -1,0 +2,5 @@
+Fri Jan 22 07:55:32 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 0.6.3.1
+
+-------------------------------------------------------------------
Old:
----
cabal-helper-0.6.3.0.tar.gz
New:
----
cabal-helper-0.6.3.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-cabal-helper.spec ++++++
--- /var/tmp/diff_new_pack.BjaXtF/_old 2016-01-28 17:24:32.000000000 +0100
+++ /var/tmp/diff_new_pack.BjaXtF/_new 2016-01-28 17:24:32.000000000 +0100
@@ -19,7 +19,7 @@
%global pkg_name cabal-helper
%bcond_with tests
Name: ghc-cabal-helper
-Version: 0.6.3.0
+Version: 0.6.3.1
Release: 0
Summary: Simple interface to some of Cabal's configuration state used by ghc-mod
License: AGPL-3.0+
++++++ cabal-helper-0.6.3.0.tar.gz -> cabal-helper-0.6.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cabal-helper-0.6.3.0/CabalHelper/Compile.hs new/cabal-helper-0.6.3.1/CabalHelper/Compile.hs
--- old/cabal-helper-0.6.3.0/CabalHelper/Compile.hs 2015-11-25 23:10:09.000000000 +0100
+++ new/cabal-helper-0.6.3.1/CabalHelper/Compile.hs 2016-01-14 19:19:13.000000000 +0100
@@ -97,7 +97,8 @@
compileSandbox :: FilePath -> MaybeT IO (Either ExitCode FilePath)
compileSandbox chdir = do
sandbox <- MaybeT $ getSandboxPkgDb projdir (display buildPlatform) =<< ghcVersion opts
- ver <- MaybeT $ find (== cabalVer) <$> listCabalVersions' opts (Just sandbox)
+ ver <- MaybeT $ logSomeError opts "compileSandbox" $
+ find (== cabalVer) <$> listCabalVersions' opts (Just sandbox)
vLog opts $ logMsg ++ "sandbox package-db"
liftIO $ compileWithPkg chdir (Just sandbox) ver
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cabal-helper-0.6.3.0/CabalHelper/GuessGhc.hs new/cabal-helper-0.6.3.1/CabalHelper/GuessGhc.hs
--- old/cabal-helper-0.6.3.0/CabalHelper/GuessGhc.hs 2015-04-27 21:16:53.000000000 +0200
+++ new/cabal-helper-0.6.3.1/CabalHelper/GuessGhc.hs 2016-01-17 21:29:42.000000000 +0100
@@ -49,11 +49,11 @@
path = ghcPath
dir = takeDirectory path
versionSuffix = takeVersionSuffix (dropExeExtension path)
- guessNormal = dir </> toolname <.> exeExtension
+ guessNormal = dir </> toolname <.> exeExtension'
guessGhcVersioned = dir </> (toolname ++ "-ghc" ++ versionSuffix)
- <.> exeExtension
+ <.> exeExtension'
guessVersioned = dir </> (toolname ++ versionSuffix)
- <.> exeExtension
+ <.> exeExtension'
guesses | null versionSuffix = [guessNormal]
| otherwise = [guessGhcVersioned,
guessVersioned,
@@ -70,7 +70,7 @@
dropExeExtension :: FilePath -> FilePath
dropExeExtension filepath =
case splitExtension filepath of
- (filepath', extension) | extension == exeExtension -> filepath'
+ (filepath', extension) | extension == exeExtension' -> filepath'
| otherwise -> filepath
-- | @takeWhileEndLE p@ is equivalent to @reverse . takeWhile p . reverse@, but
@@ -81,3 +81,6 @@
go x (rest, done)
| not done && p x = (x:rest, False)
| otherwise = (rest, True)
+
+exeExtension' :: FilePath
+exeExtension' = Distribution.Simple.BuildPaths.exeExtension
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cabal-helper-0.6.3.0/CabalHelper/Log.hs new/cabal-helper-0.6.3.1/CabalHelper/Log.hs
--- old/cabal-helper-0.6.3.0/CabalHelper/Log.hs 2015-08-21 06:28:15.000000000 +0200
+++ new/cabal-helper-0.6.3.1/CabalHelper/Log.hs 2016-01-14 19:19:13.000000000 +0100
@@ -2,6 +2,7 @@
import Control.Monad
import Control.Monad.IO.Class
+import Control.Exception as E
import Data.String
import System.IO
import Prelude
@@ -12,3 +13,9 @@
vLog Options { verbose = True } msg =
liftIO $ hPutStrLn stderr msg
vLog _ _ = return ()
+
+logSomeError :: Options -> String -> IO (Maybe a) -> IO (Maybe a)
+logSomeError opts label a = do
+ a `E.catch` \se@(SomeException _) -> do
+ vLog opts $ label ++ ": " ++ show se
+ return Nothing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cabal-helper-0.6.3.0/Distribution/Helper.hs new/cabal-helper-0.6.3.1/Distribution/Helper.hs
--- old/cabal-helper-0.6.3.0/Distribution/Helper.hs 2016-01-10 22:00:45.000000000 +0100
+++ new/cabal-helper-0.6.3.1/Distribution/Helper.hs 2016-01-17 21:26:39.000000000 +0100
@@ -416,7 +416,7 @@
findLibexecExe "cabal-helper-wrapper" = do
libexecdir <- getLibexecDir
let exeName = "cabal-helper-wrapper"
- exe = libexecdir </> exeName <.> exeExtension
+ exe = libexecdir </> exeName <.> exeExtension'
exists <- doesFileExist exe
@@ -476,3 +476,6 @@
lookupEnv' :: String -> IO (Maybe String)
lookupEnv' k = lookup k <$> getEnvironment
+
+exeExtension' :: FilePath
+exeExtension' = Distribution.Simple.BuildPaths.exeExtension
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cabal-helper-0.6.3.0/Setup.hs new/cabal-helper-0.6.3.1/Setup.hs
--- old/cabal-helper-0.6.3.0/Setup.hs 2015-04-27 21:16:53.000000000 +0200
+++ new/cabal-helper-0.6.3.1/Setup.hs 2016-01-14 19:17:15.000000000 +0100
@@ -6,6 +6,7 @@
import Distribution.Simple.Register
import Distribution.Simple.InstallDirs as ID
import Distribution.Simple.LocalBuildInfo
+import Distribution.Simple.Program
import Distribution.PackageDescription
import Control.Applicative
@@ -17,7 +18,8 @@
main :: IO ()
main = defaultMainWithHooks $ simpleUserHooks {
instHook = inst,
- copyHook = copy
+ copyHook = copy,
+ hookedPrograms = [ simpleProgram "cabal" ]
}
-- mostly copypasta from 'defaultInstallHook'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cabal-helper-0.6.3.0/cabal-helper.cabal new/cabal-helper-0.6.3.1/cabal-helper.cabal
--- old/cabal-helper-0.6.3.0/cabal-helper.cabal 2016-01-10 22:00:59.000000000 +0100
+++ new/cabal-helper-0.6.3.1/cabal-helper.cabal 2016-01-18 20:53:46.000000000 +0100
@@ -1,5 +1,5 @@
name: cabal-helper
-version: 0.6.3.0
+version: 0.6.3.1
synopsis: Simple interface to some of Cabal's configuration state used by ghc-mod
description:
@cabal-helper@ provides a library which wraps the internal use of
@@ -87,8 +87,17 @@
Default-Language: Haskell2010
Type: exitcode-stdio-1.0
Main-Is: Spec.hs
+ Other-Modules: CabalHelper.Common
+ CabalHelper.Compile
+ CabalHelper.Data
+ CabalHelper.Log
+ CabalHelper.Sandbox
+ CabalHelper.Types
+ Distribution.Helper
+ Paths_cabal_helper
Hs-Source-Dirs: tests, .
GHC-Options: -Wall
+ Build-Tools: cabal
Build-Depends: base >= 4.5 && < 5
, cabal-helper
, extra
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cabal-helper-0.6.3.0/tests/Spec.hs new/cabal-helper-0.6.3.1/tests/Spec.hs
--- old/cabal-helper-0.6.3.0/tests/Spec.hs 2016-01-10 22:00:45.000000000 +0100
+++ new/cabal-helper-0.6.3.1/tests/Spec.hs 2016-01-17 22:21:02.000000000 +0100
@@ -55,6 +55,10 @@
"1.22.2.0"
, "1.22.3.0"
, "1.22.4.0"
+ , "1.22.5.0"
+ , "1.22.6.0"
+ ]),
+ ("8.0", [
])
]
1
0
Hello community,
here is the log from the commit of package ghc-bifunctors for openSUSE:Factory checked in at 2016-01-28 17:23:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-bifunctors (Old)
and /work/SRC/openSUSE:Factory/.ghc-bifunctors.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-bifunctors"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-bifunctors/ghc-bifunctors.changes 2016-01-08 15:23:11.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-bifunctors.new/ghc-bifunctors.changes 2016-01-28 17:24:31.000000000 +0100
@@ -1,0 +2,9 @@
+Wed Jan 20 08:55:42 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 5.2
+* dded several Arrow-like instances for Tannen so we can use it as the Cayley
+ construction if needed.
+* Added Data.Bifunctor.Sum
+* Added BifunctorFunctor, BifunctorMonad and BifunctorComonad.
+
+-------------------------------------------------------------------
Old:
----
bifunctors-5.1.tar.gz
New:
----
bifunctors-5.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-bifunctors.spec ++++++
--- /var/tmp/diff_new_pack.KK2FzZ/_old 2016-01-28 17:24:31.000000000 +0100
+++ /var/tmp/diff_new_pack.KK2FzZ/_new 2016-01-28 17:24:31.000000000 +0100
@@ -19,7 +19,7 @@
%global pkg_name bifunctors
Name: ghc-bifunctors
-Version: 5.1
+Version: 5.2
Release: 0
Summary: Bifunctors
License: BSD-2-Clause
@@ -32,6 +32,8 @@
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-rpm-macros
# Begin cabal-rpm deps:
+BuildRequires: ghc-comonad-devel
+BuildRequires: ghc-containers-devel
BuildRequires: ghc-semigroups-devel
BuildRequires: ghc-tagged-devel
BuildRequires: ghc-template-haskell-devel
++++++ bifunctors-5.1.tar.gz -> bifunctors-5.2.tar.gz ++++++
++++ 1684 lines of diff (skipped)
1
0
Hello community,
here is the log from the commit of package ghc-base-compat for openSUSE:Factory checked in at 2016-01-28 17:23:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-base-compat (Old)
and /work/SRC/openSUSE:Factory/.ghc-base-compat.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-base-compat"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-base-compat/ghc-base-compat.changes 2015-12-24 12:16:19.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-base-compat.new/ghc-base-compat.changes 2016-01-28 17:24:29.000000000 +0100
@@ -1,0 +2,22 @@
+Wed Jan 20 08:43:57 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 0.9.0
+* Sync with base-4.9/GHC 8.0
+* Weakened RealFloat constraints on realPart, imagPart, conjugate, mkPolar, and cis
+ in Data.Complex.Compat
+* Backport Foreign.ForeignPtr.Safe and Foreign.Marshal.Safe
+* Generalize filterM, forever, mapAndUnzipM, zipWithM, zipWithM_, replicateM,
+ and replicateM_ in Control.Monad from Monad to Applicative
+* Backport .Unsafe.Compat modules (for Control.Monad.ST, Control.Monad.ST.Lazy,
+ Foreign.ForeignPtr, and Foreign.Marshal)
+* Backport forkFinally and forkOSWithUnmask to Control.Concurrent.Compat
+* Backport Data.Functor.Const
+* Backport modifyIORef', atomicModifyIORef' and atomicWriteIORef to Data.IORef.Compat
+* Data.Ratio.{denominator,numerator} have no Integral constraint anymore
+* Backport modifySTRef' to Data.STRef.Compat
+* Export String, lines, words, unlines, and unwords to Data.String.Compat
+* Generalize Debug.Trace.{traceM, traceShowM} from Monad to Applicative
+* Backport errorWithoutStackTrace to Prelude.Compat
+* Backport unsafeFixIO and unsafeDupablePerformIO to System.IO.Unsafe.Compat
+
+-------------------------------------------------------------------
Old:
----
base-compat-0.8.2.tar.gz
New:
----
base-compat-0.9.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-base-compat.spec ++++++
--- /var/tmp/diff_new_pack.uAgpB6/_old 2016-01-28 17:24:29.000000000 +0100
+++ /var/tmp/diff_new_pack.uAgpB6/_new 2016-01-28 17:24:29.000000000 +0100
@@ -20,7 +20,7 @@
%bcond_with tests
Name: ghc-base-compat
-Version: 0.8.2
+Version: 0.9.0
Release: 0
Summary: A compatibility layer for base
Group: System/Libraries
++++++ base-compat-0.8.2.tar.gz -> base-compat-0.9.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/CHANGES.markdown new/base-compat-0.9.0/CHANGES.markdown
--- old/base-compat-0.8.2/CHANGES.markdown 2015-05-13 08:36:37.000000000 +0200
+++ new/base-compat-0.9.0/CHANGES.markdown 2016-01-15 03:45:49.000000000 +0100
@@ -1,3 +1,26 @@
+## Changes in 0.9.0
+ - Sync with `base-4.9`/GHC 8.0
+ - Weakened `RealFloat` constraints on `realPart`, `imagPart`, `conjugate`,
+ `mkPolar`, and `cis` in `Data.Complex.Compat`
+ - Backport `Foreign.ForeignPtr.Safe` and `Foreign.Marshal.Safe`
+ - Generalize `filterM`, `forever`, `mapAndUnzipM`, `zipWithM`, `zipWithM_`,
+ `replicateM`, and `replicateM_` in `Control.Monad` from `Monad` to
+ `Applicative`
+ - Backport `.Unsafe.Compat` modules (for `Control.Monad.ST`,
+ `Control.Monad.ST.Lazy`, `Foreign.ForeignPtr`, and `Foreign.Marshal`)
+ - Backport `forkFinally` and `forkOSWithUnmask` to `Control.Concurrent.Compat`
+ - Backport `Data.Functor.Const`
+ - Backport `modifyIORef'`, `atomicModifyIORef'` and `atomicWriteIORef` to
+ `Data.IORef.Compat`
+ - `Data.Ratio.{denominator,numerator}` have no `Integral` constraint anymore
+ - Backport `modifySTRef'` to `Data.STRef.Compat`
+ - Export `String`, `lines`, `words`, `unlines`, and `unwords` to
+ `Data.String.Compat`
+ - Generalize `Debug.Trace.{traceM, traceShowM}` from `Monad` to `Applicative`
+ - Backport `errorWithoutStackTrace` to `Prelude.Compat`
+ - Backport `unsafeFixIO` and `unsafeDupablePerformIO` to
+ `System.IO.Unsafe.Compat`
+
## Changes in 0.8.2
- Backport `bitDefault`, `testBitDefault`, and `popCountDefault` in
`Data.Bits.Compat` to all versions of `base`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/LICENSE new/base-compat-0.9.0/LICENSE
--- old/base-compat-0.8.2/LICENSE 2015-05-13 08:36:37.000000000 +0200
+++ new/base-compat-0.9.0/LICENSE 2016-01-15 03:45:49.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright (c) 2012-2015 Simon Hengel <sol(a)typeful.net> and Ryan Scott <ryan.gl.scott(a)ku.edu>
+Copyright (c) 2012-2015 Simon Hengel <sol(a)typeful.net> and Ryan Scott <ryan.gl.scott(a)gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/README.markdown new/base-compat-0.9.0/README.markdown
--- old/base-compat-0.8.2/README.markdown 2015-05-13 08:36:37.000000000 +0200
+++ new/base-compat-0.9.0/README.markdown 2016-01-15 03:45:49.000000000 +0100
@@ -1,4 +1,20 @@
-# A compatibility layer for `base` [![Hackage version](https://img.shields.io/hackage/v/base-compat.svg?style=flat)](http… [![Build Status](https://img.shields.io/travis/haskell-compat/base-compat.svg?style=…
+# A compatibility layer for `base`
+[![Hackage](https://img.shields.io/hackage/v/base-compat.svg)][Hackage: base-compat]
+[![Hackage Dependencies](https://img.shields.io/hackage-deps/v/base-compat.svg)](http:…
+[![Haskell Programming Language](https://img.shields.io/badge/language-Haskell-blue.svg)][Haskell.org]
+[![BSD3 License](http://img.shields.io/badge/license-MIT-brightgreen.svg)][tl;dr Legal: MIT]
+[![Build](https://img.shields.io/travis/haskell-compat/base-compat.svg)](https://travis-ci.org/haskell-compat/base-compat)
+
+[Hackage: base-compat]:
+ http://hackage.haskell.org/package/base-compat
+ "base-compat package on Hackage"
+[Haskell.org]:
+ http://www.haskell.org
+ "The Haskell Programming Language"
+[tl;dr Legal: MIT]:
+ https://tldrlegal.com/license/mit-license
+ "MIT License"
+
## Scope
The scope of `base-compat` is to provide functions available in later versions
@@ -12,13 +28,19 @@
package [`base-orphans`](https://github.com/haskell-compat/base-orphans) for
that.
+In addition, `base-compat` only backports functions. In particular, we
+purposefully do not backport data types or type classes introduced in newer
+versions of `base`. For more info, see the
+[Data types and type classes](#data-types-and-type-classes)
+section.
+
## Basic usage
In your cabal file, you should have something like this:
```
build-depends: base >= 4.3
- , base-compat >= 0.8.0
+ , base-compat >= 0.9.0
```
Then, lets say you want to use the `isRight` function introduced with
@@ -83,7 +105,7 @@
### For compatibility with the latest released version of `base`
* `Prelude.Compat` incorporates the AMP/Foldable/Traversable changes and
- exposes the same interface as `Prelude` from `base-4.8.0.0`
+ exposes the same interface as `Prelude` from `base-4.9.0.0`
* `System.IO.Error.catch` is not re-exported from `Prelude.Compat` for older
versions of `base`
* `Text.Read.Compat.readMaybe`
@@ -93,13 +115,19 @@
* Added `toIntegralSized` to `Data.Bits.Compat` (if using `base-4.7`)
* Added `bool` function to `Data.Bool.Compat`
* Added `isLeft` and `isRight` to `Data.Either.Compat`
+ * Added `forkFinally` to `Control.Concurrent.Compat`
* Added `withMVarMasked` function to `Control.Concurrent.MVar.Compat`
* Added `(<$!>)` function to `Control.Monad.Compat`
+ * Weakened `RealFloat` constraints on `realPart`, `imagPart`, `conjugate`, `mkPolar`,
+ and `cis` in `Data.Complex.Compat`
* Added `($>)` and `void` functions to `Data.Functor.Compat`
* `(&)` function to `Data.Function.Compat`
* `($>)` and `void` functions to `Data.Functor.Compat`
+ * `modifyIORef'`, `atomicModifyIORef'` and `atomicWriteIORef` to `Data.IORef.Compat`
* `dropWhileEnd`, `isSubsequenceOf`, `sortOn`, and `uncons` functions to `Data.List.Compat`
* Correct versions of `nub`, `nubBy`, `union`, and `unionBy` to `Data.List.Compat`
+ * `modifySTRef'` to `Data.STRef.Compat`
+ * `String`, `lines`, `words`, `unlines`, and `unwords` to `Data.String.Compat`
* `makeVersion` function to `Data.Version.Compat`
* `traceId`, `traceShowId`, `traceM`, and `traceShowM` functions to `Debug.Trace.Compat`
* `byteSwap16`, `byteSwap32`, and `byteSwap64` to `Data.Word.Compat`
@@ -109,9 +137,114 @@
* Added `Data.List.Compat.scanl'`
* `showFFloatAlt` and `showGFloatAlt` to `Numeric.Compat`
* `lookupEnv`, `setEnv` and `unsetEnv` to `System.Environment.Compat`
+ * `unsafeFixIO` and `unsafeDupablePerformIO` to `System.IO.Unsafe.IO`
+
+## What is not covered
+
+### Data types and type classes
+`base-compat` purposefully does not export any data types or type classes that
+were introduced in more recent versions of `base`. The main reasoning for this
+policy is that it is not some data types and type classes have had their APIs
+change in different versions of `base`, which makes having a consistent
+compatibility API for them practically impossible.
+
+As an example, consider the `FiniteBits` type class. It was introduced in
+[`base-4.7.0.0`](http://hackage.haskell.org/package/base-4.7.0.0/docs/Data-Bits.html#t:FiniteBits)
+with the following API:
+
+```haskell
+class Bits b => FiniteBits b where
+ finiteBitSize :: b -> Int
+```
-## Supported versions of GHC/base
+However, in [`base-4.8.0.0`](http://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Bits.html#t:FiniteBits),
+`FiniteBits` gained additional functions:
+
+```haskell
+class Bits b => FiniteBits b where
+ finiteBitSize :: b -> Int
+ countLeadingZeros :: b -> Int
+ countTrailingZeros :: b -> Int
+```
+
+This raises the question: how can `FiniteBits` be backported consistently
+across all versions of `base`? One approach is to backport the API exposed in
+`base-4.8.0.0` on versions prior to `4.7.0.0`. The problem with this is that
+`countLeadingZeros` and `countTrailingZeros` are not exposed in `base-4.7.0.0`,
+so instances of `FiniteBits` would have to be declared like this:
+
+```haskell
+instance FiniteBits Foo where
+ finiteBitSize = ...
+#if MIN_VERSION_base(4,8,0) || !(MIN_VERSION_base(4,7,0))
+ countLeadingZeros = ...
+ countTrailingZeros = ...
+#endif
+```
+This is a very unsatisfactory solution, and for this reason, we do not pursue
+it. For similar reasons, we do not backport data types.
+
+### Other compatibility packages
+
+If you _really_ need your favorite data type or type class in `base` to be
+backported, you might be in luck, since several data types have their own
+compatibility packages on Hackage. Here is a list of such packages:
+
+* [`bifunctors`](http://hackage.haskell.org/package/bifunctors)
+ for the [`Bifunctor`](http://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Bifunctor.html#t:Bifunctor)
+ type class, introduced in `base-4.8.0.0`
+* [`generic-deriving`](http://hackage.haskell.org/package/generic-deriving)
+ for everything in the [`GHC.Generics`](http://hackage.haskell.org/package/base-4.8.0.0/docs/GHC-Generics.html)
+ module, introduced to `ghc-prim` in GHC 7.2 (and later moved to `base-4.6.0.0`)
+* [`nats`](http://hackage.haskell.org/package/nats)
+ for the [`Natural`](http://hackage.haskell.org/package/base-4.8.0.0/docs/Numeric-Natural.html)
+ data type, introduced in `base-4.8.0.0`
+* [`semigroups`](http://hackage.haskell.org/package/semigroups)
+ for the [`Semigroup`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Semigroup)
+ typeclass and the
+ [`NonEmpty`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-List-NonEmpty.html#t:NonEmpty),
+ [`Min`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Min),
+ [`Max`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Max),
+ [`First`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:First),
+ [`Last`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Last),
+ [`WrappedMonoid`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:WrappedMonoid),
+ [`Option`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Option),
+ and
+ [`Arg`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Semigroup.html#t:Arg)
+ data types, introduced in `base-4.9.0.0`
+* [`tagged`](http://hackage.haskell.org/package/tagged)
+ for the [`Proxy`](http://hackage.haskell.org/package/base-4.7.0.0/docs/Data-Proxy.html#t:Proxy)
+ data type, introduced in `base-4.7.0.0`
+* [`transformers`](http://hackage.haskell.org/package/transformers)
+ for:
+ * The [`Identity`](http://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Functor-Identity.html#t:Identity)
+ data type, introduced in `base-4.8.0.0`
+ * The [`MonadIO`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Monad-IO-Class.html#t:MonadIO),
+ [`Eq1`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Classes.html#t:Eq1),
+ [`Eq2`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Classes.html#t:Eq2),
+ [`Ord1`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Classes.html#t:Ord1),
+ [`Ord2`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Classes.html#t:Ord2),
+ [`Read1`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Classes.html#t:Read1),
+ [`Read2`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Classes.html#t:Read2),
+ [`Show1`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Classes.html#t:Show1),
+ and
+ [`Show2`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Classes.html#t:Show2)
+ typeclasses; and the
+ [`Compose`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Compose.html#t:Compose),
+ [`Product`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Product.html#t:Product),
+ and
+ [`Sum`](http://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Functor-Sum.html#t:Sum)
+ data types, introduced in `base-4.9.0.0`
+* [`void`](http://hackage.haskell.org/package/void)
+ for the [`Void`](http://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Void.html#t:Void)
+ data type, introduced in `base-4.8.0.0`
+
+## Supported versions of GHC/`base`
+
+ * `ghc-8.0.1` / `base-4.9.0.0`
+ * `ghc-7.10.3` / `base-4.8.2.0`
+ * `ghc-7.10.2` / `base-4.8.1.0`
* `ghc-7.10.1` / `base-4.8.0.0`
* `ghc-7.8.4` / `base-4.7.0.2`
* `ghc-7.8.3` / `base-4.7.0.1`
@@ -129,16 +262,8 @@
* `ghc-7.0.2` / `base-4.3.1.0`
* `ghc-7.0.1` / `base-4.3.0.0`
-Patches are welcome; add tests for new code!
-
-## Development
+We also make an attempt to keep `base-compat` building with GHC HEAD, but due
+to its volatility, it may not work at any given point in time. If it doesn't,
+please report it!
-For `Prelude.Compat` there is an `Prelude.index` file that was generated from
-the output of
-
- ghc --show-iface Prelude.hi
-
-To verify that `Prelude.Compat` matches the specification given in
-`Prelude.types` run:
-
- ./check-Prelude.sh
+Patches are welcome; add tests for new code!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/base-compat.cabal new/base-compat-0.9.0/base-compat.cabal
--- old/base-compat-0.8.2/base-compat.cabal 2015-05-13 08:36:37.000000000 +0200
+++ new/base-compat-0.9.0/base-compat.cabal 2016-01-15 03:45:49.000000000 +0100
@@ -1,5 +1,5 @@
name: base-compat
-version: 0.8.2
+version: 0.9.0
license: MIT
license-file: LICENSE
copyright: (c) 2012-2015 Simon Hengel,
@@ -7,10 +7,10 @@
(c) 2015 Ryan Scott
author: Simon Hengel <sol(a)typeful.net>,
João Cristóvão <jmacristovao(a)gmail.com>,
- Ryan Scott <ryan.gl.scott(a)ku.edu>
+ Ryan Scott <ryan.gl.scott(a)gmail.com>
maintainer: Simon Hengel <sol(a)typeful.net>,
João Cristóvão <jmacristovao(a)gmail.com>,
- Ryan Scott <ryan.gl.scott(a)ku.edu>
+ Ryan Scott <ryan.gl.scott(a)gmail.com>
build-type: Simple
cabal-version: >= 1.8
category: Compatibility
@@ -24,9 +24,20 @@
for recent changes.
.
Note that @base-compat@ does not add any orphan instances.
- There is a separate package
- @<http://hackage.haskell.org/package/base-orphans base-orphans>@
+ There is a separate package,
+ @<http://hackage.haskell.org/package/base-orphans base-orphans>@,
for that.
+ .
+ In addition, `base-compat` does not backport any data types
+ or type classes. See
+ @<https://github.com/haskell-compat/base-compat#data-types-and-type-classes this section of the README>@
+ for more info.
+tested-with: GHC == 7.0.1, GHC == 7.0.2, GHC == 7.0.3, GHC == 7.0.4
+ , GHC == 7.2.1, GHC == 7.2.2
+ , GHC == 7.4.1, GHC == 7.4.2
+ , GHC == 7.6.1, GHC == 7.6.2, GHC == 7.6.3
+ , GHC == 7.8.1, GHC == 7.8.2, GHC == 7.8.3, GHC == 7.8.4
+ , GHC == 7.10.1, GHC == 7.10.2, GHC == 7.10.3
extra-source-files: CHANGES.markdown, README.markdown
source-repository head
@@ -47,28 +58,42 @@
src
exposed-modules:
+ Control.Concurrent.Compat
Control.Concurrent.MVar.Compat
Control.Monad.Compat
+ Control.Monad.ST.Lazy.Unsafe.Compat
+ Control.Monad.ST.Unsafe.Compat
Data.Bits.Compat
Data.Bool.Compat
+ Data.Complex.Compat
Data.Either.Compat
Data.Foldable.Compat
Data.Function.Compat
Data.Functor.Compat
+ Data.Functor.Const.Compat
+ Data.IORef.Compat
Data.List.Compat
Data.Monoid.Compat
+ Data.Ratio.Compat
+ Data.STRef.Compat
+ Data.String.Compat
Data.Version.Compat
Data.Word.Compat
Debug.Trace.Compat
Foreign.Compat
+ Foreign.ForeignPtr.Safe.Compat
+ Foreign.ForeignPtr.Unsafe.Compat
Foreign.Marshal.Alloc.Compat
Foreign.Marshal.Array.Compat
Foreign.Marshal.Compat
+ Foreign.Marshal.Safe.Compat
+ Foreign.Marshal.Unsafe.Compat
Foreign.Marshal.Utils.Compat
Numeric.Compat
Prelude.Compat
System.Environment.Compat
System.Exit.Compat
+ System.IO.Unsafe.Compat
Text.Read.Compat
test-suite spec
@@ -80,6 +105,24 @@
test
main-is:
Spec.hs
+ other-modules:
+ Control.Monad.CompatSpec
+ Data.Bits.CompatSpec
+ Data.Bool.CompatSpec
+ Data.Either.CompatSpec
+ Data.Function.CompatSpec
+ Data.Functor.CompatSpec
+ Data.IORef.CompatSpec
+ Data.List.CompatSpec
+ Data.Monoid.CompatSpec
+ Data.STRef.CompatSpec
+ Data.Version.CompatSpec
+ Data.Word.CompatSpec
+ Foreign.Marshal.Alloc.CompatSpec
+ Foreign.Marshal.Utils.CompatSpec
+ Numeric.CompatSpec
+ System.Environment.CompatSpec
+ Text.Read.CompatSpec
build-depends:
base >= 4.3 && < 5
, base-compat
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Control/Concurrent/Compat.hs new/base-compat-0.9.0/src/Control/Concurrent/Compat.hs
--- old/base-compat-0.8.2/src/Control/Concurrent/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Control/Concurrent/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,44 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+{-# LANGUAGE RankNTypes #-}
+module Control.Concurrent.Compat (
+ module Base
+, forkFinally
+, forkOSWithUnmask
+) where
+
+import Control.Concurrent as Base
+
+#if !(MIN_VERSION_base(4,6,0))
+import Control.Exception
+#endif
+
+#if !(MIN_VERSION_base(4,9,0))
+import GHC.IO (unsafeUnmask)
+import Prelude
+#endif
+
+#if !(MIN_VERSION_base(4,6,0))
+-- | fork a thread and call the supplied function when the thread is about
+-- to terminate, with an exception or a returned value. The function is
+-- called with asynchronous exceptions masked.
+--
+-- > forkFinally action and_then =
+-- > mask $ \restore ->
+-- > forkIO $ try (restore action) >>= and_then
+--
+-- This function is useful for informing the parent when a child
+-- terminates, for example.
+--
+-- /Since: 4.6.0.0/
+forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId
+forkFinally action and_then =
+ mask $ \restore ->
+ forkIO $ try (restore action) >>= and_then
+#endif
+
+#if !(MIN_VERSION_base(4,9,0))
+-- | Like 'forkIOWithUnmask', but the child thread is a bound thread,
+-- as with 'forkOS'.
+forkOSWithUnmask :: ((forall a . IO a -> IO a) -> IO ()) -> IO ThreadId
+forkOSWithUnmask io = forkOS (io unsafeUnmask)
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Control/Monad/Compat.hs new/base-compat-0.9.0/src/Control/Monad/Compat.hs
--- old/base-compat-0.8.2/src/Control/Monad/Compat.hs 2015-05-13 08:36:37.000000000 +0200
+++ new/base-compat-0.9.0/src/Control/Monad/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -19,13 +19,30 @@
, (<$!>)
#endif
+#if !(MIN_VERSION_base(4,9,0))
+, forever
+, filterM
+, mapAndUnzipM
+, zipWithM
+, zipWithM_
+, replicateM
+, replicateM_
+#endif
) where
-#if MIN_VERSION_base(4,8,0)
+#if MIN_VERSION_base(4,9,0)
import Control.Monad as Base
#else
import Control.Monad as Base hiding (
- foldM
+ forever
+ , filterM
+ , mapAndUnzipM
+ , zipWithM
+ , zipWithM_
+ , replicateM
+ , replicateM_
+# if !(MIN_VERSION_base(4,8,0))
+ , foldM
, foldM_
, forM
, forM_
@@ -37,8 +54,9 @@
, sequence_
, unless
, when
+# endif
)
-import Control.Applicative (Alternative(..))
+import Control.Applicative
import Data.Foldable.Compat
import Data.Traversable
import Prelude.Compat
@@ -116,3 +134,51 @@
let z = f x
z `seq` return z
#endif
+
+#if !(MIN_VERSION_base(4,9,0))
+-- | @'forever' act@ repeats the action infinitely.
+forever :: (Applicative f) => f a -> f b
+{-# INLINE forever #-}
+forever a = let a' = a *> a' in a'
+-- Use explicit sharing here, as it is prevents a space leak regardless of
+-- optimizations.
+
+-- | This generalizes the list-based 'filter' function.
+{-# INLINE filterM #-}
+filterM :: (Applicative m) => (a -> m Bool) -> [a] -> m [a]
+filterM p = foldr (\ x -> liftA2 (\ flg -> if flg then (x:) else id) (p x)) (pure [])
+
+-- | The 'mapAndUnzipM' function maps its first argument over a list, returning
+-- the result as a pair of lists. This function is mainly used with complicated
+-- data structures or a state-transforming monad.
+mapAndUnzipM :: (Applicative m) => (a -> m (b,c)) -> [a] -> m ([b], [c])
+{-# INLINE mapAndUnzipM #-}
+mapAndUnzipM f xs = unzip <$> traverse f xs
+
+-- | The 'zipWithM' function generalizes 'zipWith' to arbitrary applicative functors.
+zipWithM :: (Applicative m) => (a -> b -> m c) -> [a] -> [b] -> m [c]
+{-# INLINE zipWithM #-}
+zipWithM f xs ys = sequenceA (zipWith f xs ys)
+
+-- | 'zipWithM_' is the extension of 'zipWithM' which ignores the final result.
+zipWithM_ :: (Applicative m) => (a -> b -> m c) -> [a] -> [b] -> m ()
+{-# INLINE zipWithM_ #-}
+zipWithM_ f xs ys = sequenceA_ (zipWith f xs ys)
+
+-- | @'replicateM' n act@ performs the action @n@ times,
+-- gathering the results.
+replicateM :: (Applicative m) => Int -> m a -> m [a]
+{-# INLINEABLE replicateM #-}
+{-# SPECIALISE replicateM :: Int -> IO a -> IO [a] #-}
+{-# SPECIALISE replicateM :: Int -> Maybe a -> Maybe [a] #-}
+replicateM 0 _ = pure []
+replicateM n x = liftA2 (:) x (replicateM (pred n) x)
+
+-- | Like 'replicateM', but discards the result.
+replicateM_ :: (Applicative m) => Int -> m a -> m ()
+{-# INLINEABLE replicateM_ #-}
+{-# SPECIALISE replicateM_ :: Int -> IO a -> IO () #-}
+{-# SPECIALISE replicateM_ :: Int -> Maybe a -> Maybe () #-}
+replicateM_ 0 _ = pure ()
+replicateM_ n x = x *> replicateM_ (pred n) x
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Control/Monad/ST/Lazy/Unsafe/Compat.hs new/base-compat-0.9.0/src/Control/Monad/ST/Lazy/Unsafe/Compat.hs
--- old/base-compat-0.8.2/src/Control/Monad/ST/Lazy/Unsafe/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Control/Monad/ST/Lazy/Unsafe/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,12 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Control.Monad.ST.Lazy.Unsafe.Compat (
+ -- * Unsafe operations
+ unsafeInterleaveST
+, unsafeIOToST
+) where
+
+#if MIN_VERSION_base(4,6,0)
+import Control.Monad.ST.Lazy.Unsafe (unsafeInterleaveST, unsafeIOToST)
+#else
+import Control.Monad.ST.Lazy (unsafeInterleaveST, unsafeIOToST)
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Control/Monad/ST/Unsafe/Compat.hs new/base-compat-0.9.0/src/Control/Monad/ST/Unsafe/Compat.hs
--- old/base-compat-0.8.2/src/Control/Monad/ST/Unsafe/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Control/Monad/ST/Unsafe/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,13 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Control.Monad.ST.Unsafe.Compat (
+ -- * Unsafe operations
+ unsafeInterleaveST
+, unsafeIOToST
+, unsafeSTToIO
+) where
+
+#if MIN_VERSION_base(4,6,0)
+import Control.Monad.ST.Unsafe (unsafeInterleaveST, unsafeIOToST, unsafeSTToIO)
+#else
+import Control.Monad.ST (unsafeInterleaveST, unsafeIOToST, unsafeSTToIO)
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Data/Complex/Compat.hs new/base-compat-0.9.0/src/Data/Complex/Compat.hs
--- old/base-compat-0.8.2/src/Data/Complex/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Data/Complex/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,50 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Data.Complex.Compat (
+ module Base
+#if MIN_VERSION_base(4,4,0) && !(MIN_VERSION_base(4,8,0))
+, realPart
+, imagPart
+, mkPolar
+, cis
+, conjugate
+#endif
+) where
+
+#if !(MIN_VERSION_base(4,4,0)) || MIN_VERSION_base(4,8,0)
+import Data.Complex as Base
+#else
+import Data.Complex as Base hiding (
+ realPart
+ , imagPart
+ , mkPolar
+ , cis
+ , conjugate
+ )
+import Prelude
+#endif
+
+#if MIN_VERSION_base(4,4,0) && !(MIN_VERSION_base(4,8,0))
+-- | Extracts the real part of a complex number.
+realPart :: Complex a -> a
+realPart (x :+ _) = x
+
+-- | Extracts the imaginary part of a complex number.
+imagPart :: Complex a -> a
+imagPart (_ :+ y) = y
+
+-- | The conjugate of a complex number.
+{-# SPECIALISE conjugate :: Complex Double -> Complex Double #-}
+conjugate :: Num a => Complex a -> Complex a
+conjugate (x:+y) = x :+ (-y)
+
+-- | Form a complex number from polar components of magnitude and phase.
+{-# SPECIALISE mkPolar :: Double -> Double -> Complex Double #-}
+mkPolar :: Floating a => a -> a -> Complex a
+mkPolar r theta = r * cos theta :+ r * sin theta
+
+-- | @'cis' t@ is a complex value with magnitude @1@
+-- and phase @t@ (modulo @2*'pi'@).
+{-# SPECIALISE cis :: Double -> Complex Double #-}
+cis :: Floating a => a -> Complex a
+cis theta = cos theta :+ sin theta
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Data/Functor/Const/Compat.hs new/base-compat-0.9.0/src/Data/Functor/Const/Compat.hs
--- old/base-compat-0.8.2/src/Data/Functor/Const/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Data/Functor/Const/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,4 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Data.Functor.Const.Compat (Const(..)) where
+
+import Control.Applicative (Const(..))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Data/IORef/Compat.hs new/base-compat-0.9.0/src/Data/IORef/Compat.hs
--- old/base-compat-0.8.2/src/Data/IORef/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Data/IORef/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,42 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Data.IORef.Compat (
+ module Base
+, modifyIORef'
+, atomicModifyIORef'
+, atomicWriteIORef
+) where
+
+import Data.IORef as Base
+
+#if !(MIN_VERSION_base(4,6,0))
+import Prelude
+
+-- |Strict version of 'modifyIORef'
+--
+-- /Since: 4.6.0.0/
+modifyIORef' :: IORef a -> (a -> a) -> IO ()
+modifyIORef' ref f = do
+ x <- readIORef ref
+ let x' = f x
+ x' `seq` writeIORef ref x'
+
+-- | Strict version of 'atomicModifyIORef'. This forces both the value stored
+-- in the 'IORef' as well as the value returned.
+--
+-- /Since: 4.6.0.0/
+atomicModifyIORef' :: IORef a -> (a -> (a,b)) -> IO b
+atomicModifyIORef' ref f = do
+ b <- atomicModifyIORef ref $ \a ->
+ case f a of
+ v@(a',_) -> a' `seq` v
+ b `seq` return b
+
+-- | Variant of 'writeIORef' with the \"barrier to reordering\" property that
+-- 'atomicModifyIORef' has.
+--
+-- /Since: 4.6.0.0/
+atomicWriteIORef :: IORef a -> a -> IO ()
+atomicWriteIORef ref a = do
+ x <- atomicModifyIORef ref (\_ -> (a, ()))
+ x `seq` return ()
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Data/Ratio/Compat.hs new/base-compat-0.9.0/src/Data/Ratio/Compat.hs
--- old/base-compat-0.8.2/src/Data/Ratio/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Data/Ratio/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,32 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Data.Ratio.Compat (
+ module Base
+#if MIN_VERSION_base(4,4,0) && !(MIN_VERSION_base(4,9,0))
+, denominator
+, numerator
+#endif
+) where
+
+#if !(MIN_VERSION_base(4,4,0)) || MIN_VERSION_base(4,9,0)
+import Data.Ratio as Base
+#else
+import Data.Ratio as Base hiding (
+ denominator
+ , numerator
+ )
+import GHC.Real (Ratio(..))
+#endif
+
+#if MIN_VERSION_base(4,4,0) && !(MIN_VERSION_base(4,9,0))
+-- | Extract the numerator of the ratio in reduced form:
+-- the numerator and denominator have no common factor and the denominator
+-- is positive.
+numerator :: Ratio a -> a
+numerator (x :% _) = x
+
+-- | Extract the denominator of the ratio in reduced form:
+-- the numerator and denominator have no common factor and the denominator
+-- is positive.
+denominator :: Ratio a -> a
+denominator (_ :% y) = y
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Data/STRef/Compat.hs new/base-compat-0.9.0/src/Data/STRef/Compat.hs
--- old/base-compat-0.8.2/src/Data/STRef/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Data/STRef/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,21 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Data.STRef.Compat (
+ module Base
+, modifySTRef'
+) where
+
+import Data.STRef as Base
+
+#if !(MIN_VERSION_base(4,6,0))
+import Control.Monad.ST (ST)
+import Prelude (seq)
+
+-- | Strict version of 'modifySTRef'
+--
+-- /Since: 4.6.0.0/
+modifySTRef' :: STRef s a -> (a -> a) -> ST s ()
+modifySTRef' ref f = do
+ x <- readSTRef ref
+ let x' = f x
+ x' `seq` writeSTRef ref x'
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Data/String/Compat.hs new/base-compat-0.9.0/src/Data/String/Compat.hs
--- old/base-compat-0.8.2/src/Data/String/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Data/String/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,15 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Data.String.Compat (
+ module Base
+, String
+, lines
+, words
+, unlines
+, unwords
+) where
+
+import Data.String as Base
+
+#if !(MIN_VERSION_base(4,4,0))
+import Prelude (String, lines, words, unlines, unwords)
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Debug/Trace/Compat.hs new/base-compat-0.9.0/src/Debug/Trace/Compat.hs
--- old/base-compat-0.8.2/src/Debug/Trace/Compat.hs 2015-05-13 08:36:37.000000000 +0200
+++ new/base-compat-0.9.0/src/Debug/Trace/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -6,11 +6,21 @@
, traceM
, traceShowM
) where
+
+#if !(MIN_VERSION_base(4,7,0)) || MIN_VERSION_base(4,9,0)
import Debug.Trace as Base
+#else
+import Debug.Trace as Base hiding (
+ traceM
+ , traceShowM
+ )
+#endif
-#if !(MIN_VERSION_base(4,7,0))
+#if !(MIN_VERSION_base(4,9,0))
import Prelude.Compat
+#endif
+#if !(MIN_VERSION_base(4,7,0))
{-|
Like 'trace' but returns the message instead of a third value.
@@ -26,11 +36,19 @@
-}
traceShowId :: (Show a) => a -> a
traceShowId a = trace (show a) a
+#endif
+#if !(MIN_VERSION_base(4,9,0))
{-|
-Like 'trace' but returning unit in an arbitrary monad. Allows for convenient
-use in do-notation. Note that the application of 'trace' is not an action in the
-monad, as 'traceIO' is in the 'IO' monad.
+Like 'trace' but returning unit in an arbitrary 'Applicative' context. Allows
+for convenient use in do-notation.
+
+Note that the application of 'traceM' is not an action in the 'Applicative'
+context, as 'traceIO' is in the 'IO' type. While the fresh bindings in the
+following example will force the 'traceM' expressions to be reduced every time
+the @do@-block is executed, @traceM "not crashed"@ would only be reduced once,
+and the message would only be printed once. If your monad is in 'MonadIO',
+@liftIO . traceIO@ may be a better option.
> ... = do
> x <- ...
@@ -40,20 +58,20 @@
/Since: 4.7.0.0/
-}
-traceM :: (Monad m) => String -> m ()
-traceM string = trace string $ return ()
+traceM :: (Applicative f) => String -> f ()
+traceM string = trace string $ pure ()
{-|
Like 'traceM', but uses 'show' on the argument to convert it to a 'String'.
> ... = do
> x <- ...
-> traceMShow $ x
+> traceShowM $ x
> y <- ...
-> traceMShow $ x + y
+> traceShowM $ x + y
/Since: 4.7.0.0/
-}
-traceShowM :: (Show a, Monad m) => a -> m ()
+traceShowM :: (Show a, Applicative f) => a -> f ()
traceShowM = traceM . show
#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Foreign/ForeignPtr/Safe/Compat.hs new/base-compat-0.9.0/src/Foreign/ForeignPtr/Safe/Compat.hs
--- old/base-compat-0.8.2/src/Foreign/ForeignPtr/Safe/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Foreign/ForeignPtr/Safe/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,34 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Foreign.ForeignPtr.Safe.Compat (
+ -- * Finalised data pointers
+ ForeignPtr
+ , FinalizerPtr
+#if defined(__HUGS__) || defined(__GLASGOW_HASKELL__)
+ , FinalizerEnvPtr
+#endif
+ -- ** Basic operations
+ , newForeignPtr
+ , newForeignPtr_
+ , addForeignPtrFinalizer
+#if defined(__HUGS__) || defined(__GLASGOW_HASKELL__)
+ , newForeignPtrEnv
+ , addForeignPtrFinalizerEnv
+#endif
+ , withForeignPtr
+
+#ifdef __GLASGOW_HASKELL__
+ , finalizeForeignPtr
+#endif
+
+ -- ** Low-level operations
+ , touchForeignPtr
+ , castForeignPtr
+
+ -- ** Allocating managed memory
+ , mallocForeignPtr
+ , mallocForeignPtrBytes
+ , mallocForeignPtrArray
+ , mallocForeignPtrArray0
+ ) where
+
+import Foreign.ForeignPtr
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Foreign/ForeignPtr/Unsafe/Compat.hs new/base-compat-0.9.0/src/Foreign/ForeignPtr/Unsafe/Compat.hs
--- old/base-compat-0.8.2/src/Foreign/ForeignPtr/Unsafe/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Foreign/ForeignPtr/Unsafe/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,11 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Foreign.ForeignPtr.Unsafe.Compat (
+ -- ** Unsafe low-level operations
+ unsafeForeignPtrToPtr
+) where
+
+#if MIN_VERSION_base(4,6,0)
+import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)
+#else
+import Foreign.ForeignPtr (unsafeForeignPtrToPtr)
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Foreign/Marshal/Safe/Compat.hs new/base-compat-0.9.0/src/Foreign/Marshal/Safe/Compat.hs
--- old/base-compat-0.8.2/src/Foreign/Marshal/Safe/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Foreign/Marshal/Safe/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,16 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Foreign.Marshal.Safe.Compat (
+ -- | The module "Foreign.Marshal.Safe" re-exports the other modules in the
+ -- @Foreign.Marshal@ hierarchy:
+ module Foreign.Marshal.Alloc
+ , module Foreign.Marshal.Array
+ , module Foreign.Marshal.Error
+ , module Foreign.Marshal.Pool
+ , module Foreign.Marshal.Utils
+ ) where
+
+import Foreign.Marshal.Alloc
+import Foreign.Marshal.Array
+import Foreign.Marshal.Error
+import Foreign.Marshal.Pool
+import Foreign.Marshal.Utils
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Foreign/Marshal/Unsafe/Compat.hs new/base-compat-0.9.0/src/Foreign/Marshal/Unsafe/Compat.hs
--- old/base-compat-0.8.2/src/Foreign/Marshal/Unsafe/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/Foreign/Marshal/Unsafe/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,11 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module Foreign.Marshal.Unsafe.Compat (
+ -- * Unsafe functions
+ unsafeLocalState
+) where
+
+#if MIN_VERSION_base(4,6,0)
+import Foreign.Marshal.Unsafe (unsafeLocalState)
+#else
+import Foreign.Marshal (unsafeLocalState)
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/Prelude/Compat.hs new/base-compat-0.9.0/src/Prelude/Compat.hs
--- old/base-compat-0.8.2/src/Prelude/Compat.hs 2015-05-13 08:36:37.000000000 +0200
+++ new/base-compat-0.9.0/src/Prelude/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -1,6 +1,6 @@
{-# LANGUAGE CPP, NoImplicitPrelude #-}
module Prelude.Compat (
-#if MIN_VERSION_base(4,8,0)
+#if MIN_VERSION_base(4,9,0)
module Base
#else
either
@@ -101,6 +101,7 @@
, (||)
, ($)
, error
+, errorWithoutStackTrace
, undefined
, seq
@@ -257,7 +258,7 @@
) where
-#if MIN_VERSION_base(4,8,0)
+#if MIN_VERSION_base(4,9,0)
import Prelude as Base
@@ -290,9 +291,21 @@
, sum
)
-import Data.Word
import Data.Foldable.Compat
import Data.Traversable
-import Data.Monoid
+
+# if !(MIN_VERSION_base(4,8,0))
import Control.Applicative
+import Data.Monoid
+import Data.Word
+# endif
+#endif
+
+#if !(MIN_VERSION_base(4,9,0))
+-- | A variant of 'error' that does not produce a stack trace.
+--
+-- /Since: 4.9.0.0/
+errorWithoutStackTrace :: [Char] -> a
+errorWithoutStackTrace s = error s
+{-# NOINLINE errorWithoutStackTrace #-}
#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/src/System/IO/Unsafe/Compat.hs new/base-compat-0.9.0/src/System/IO/Unsafe/Compat.hs
--- old/base-compat-0.8.2/src/System/IO/Unsafe/Compat.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/src/System/IO/Unsafe/Compat.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,35 @@
+{-# LANGUAGE CPP, NoImplicitPrelude #-}
+module System.IO.Unsafe.Compat (
+ module Base
+, unsafeFixIO
+, unsafeDupablePerformIO
+) where
+
+import System.IO.Unsafe as Base
+
+#if !(MIN_VERSION_base(4,5,0))
+import Control.Exception
+import Data.IORef
+import GHC.Base
+import GHC.IO
+
+-- | A slightly faster version of `System.IO.fixIO` that may not be
+-- safe to use with multiple threads. The unsafety arises when used
+-- like this:
+--
+-- > unsafeFixIO $ \r -> do
+-- > forkIO (print r)
+-- > return (...)
+--
+-- In this case, the child thread will receive a @NonTermination@
+-- exception instead of waiting for the value of @r@ to be computed.
+--
+-- /Since: 4.5.0.0/
+unsafeFixIO :: (a -> IO a) -> IO a
+unsafeFixIO k = do
+ ref <- newIORef (throw NonTermination)
+ ans <- unsafeDupableInterleaveIO (readIORef ref)
+ result <- k ans
+ writeIORef ref result
+ return result
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Control/Monad/CompatSpec.hs new/base-compat-0.9.0/test/Control/Monad/CompatSpec.hs
--- old/base-compat-0.8.2/test/Control/Monad/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Control/Monad/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,16 @@
+module Control.Monad.CompatSpec (main, spec) where
+
+import Test.Hspec
+
+import Control.Monad.Compat
+import Prelude ()
+import Prelude.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "(<$!>)" $ do
+ it "is a strict version of (<$>)" $ do
+ not <$!> [True, False] `shouldBe` not <$> [True, False]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Data/Bits/CompatSpec.hs new/base-compat-0.9.0/test/Data/Bits/CompatSpec.hs
--- old/base-compat-0.8.2/test/Data/Bits/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Data/Bits/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,34 @@
+{-# LANGUAGE CPP #-}
+module Data.Bits.CompatSpec (main, spec) where
+
+import Test.Hspec
+import Data.Bits.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "bitDefault" $
+ it "sets the ith bit with all other bits clear" $ do
+ bitDefault 0 `shouldBe` (1 :: Int)
+ bitDefault 1 `shouldBe` (2 :: Int)
+ bitDefault 2 `shouldBe` (4 :: Int)
+ bitDefault 3 `shouldBe` (8 :: Int)
+ describe "testBitDefault" $
+ it "returns True if the nth bit of the argument is 1" $ do
+ testBitDefault (10 :: Int) 0 `shouldBe` False
+ testBitDefault (10 :: Int) 1 `shouldBe` True
+ testBitDefault (10 :: Int) 2 `shouldBe` False
+ testBitDefault (10 :: Int) 3 `shouldBe` True
+ describe "popCountDefault" $
+ it "returns the number of set bits in the argument" $ do
+ popCountDefault (0 :: Int) `shouldBe` 0
+ popCountDefault (1 :: Int) `shouldBe` 1
+ popCountDefault (10 :: Int) `shouldBe` 2
+#if MIN_VERSION_base(4,7,0)
+ describe "toIntegralSized" $
+ it "converts an Integral type to another as measured by bitSizeMaybe" $ do
+ toIntegralSized (42 :: Integer) `shouldBe` (Just 42 :: Maybe Int)
+ toIntegralSized (12345678901234567890 :: Integer) `shouldBe` (Nothing :: Maybe Int)
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Data/Bool/CompatSpec.hs new/base-compat-0.9.0/test/Data/Bool/CompatSpec.hs
--- old/base-compat-0.8.2/test/Data/Bool/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Data/Bool/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,18 @@
+module Data.Bool.CompatSpec (main, spec) where
+
+import Test.Hspec
+
+import Data.Bool.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "bool" $ do
+ it "evaluates to first parameter if condition is False" $ do
+ bool "KO" "OK" False `shouldBe` "KO"
+
+ it "evaluates to second parameter if condition is True" $ do
+ bool "KO" "OK" True `shouldBe` "OK"
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Data/Either/CompatSpec.hs new/base-compat-0.9.0/test/Data/Either/CompatSpec.hs
--- old/base-compat-0.8.2/test/Data/Either/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Data/Either/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,25 @@
+module Data.Either.CompatSpec (main, spec) where
+
+import Test.Hspec
+
+import Data.Either.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "isLeft" $ do
+ it "returns True for a Left value" $ do
+ isLeft (Left "23" :: Either String String) `shouldBe` True
+
+ it "returns False for a Right value" $ do
+ isLeft (Right "23" :: Either String String) `shouldBe` False
+
+ describe "isRight" $ do
+ it "returns False for a Left value" $ do
+ isRight (Left "23" :: Either String String) `shouldBe` False
+
+ it "returns True for a Right value" $ do
+ isRight (Right "23" :: Either String String) `shouldBe` True
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Data/Function/CompatSpec.hs new/base-compat-0.9.0/test/Data/Function/CompatSpec.hs
--- old/base-compat-0.8.2/test/Data/Function/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Data/Function/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,13 @@
+module Data.Function.CompatSpec (main, spec) where
+
+import Test.Hspec
+import Data.Function.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "&" $ do
+ it "reverses function application" $ do
+ (False & not) `shouldBe` True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Data/Functor/CompatSpec.hs new/base-compat-0.9.0/test/Data/Functor/CompatSpec.hs
--- old/base-compat-0.8.2/test/Data/Functor/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Data/Functor/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,17 @@
+module Data.Functor.CompatSpec (main, spec) where
+
+import Test.Hspec
+import Data.Functor.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "void" $ do
+ it "discards computation result" $ do
+ void (return 1 :: IO Int) `shouldReturn` ()
+
+ describe "$>" $ do
+ it "is the same as flipped <$" $ do
+ (Just 5 :: Maybe Int) $> 6 `shouldBe` (Just 6 :: Maybe Int)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Data/IORef/CompatSpec.hs new/base-compat-0.9.0/test/Data/IORef/CompatSpec.hs
--- old/base-compat-0.8.2/test/Data/IORef/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Data/IORef/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,22 @@
+module Data.IORef.CompatSpec (main, spec) where
+
+import Test.Hspec
+
+import Control.Monad
+import Data.IORef.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "modifyIORef'" $
+ it "mutates the contents of an IORef strictly" $ do
+ ref <- newIORef 0
+ replicateM_ 1000000 $ modifyIORef' ref (+1)
+ readIORef ref `shouldReturn` (1000000 :: Int)
+ describe "atomicModifyIORef'" $
+ it "atomically modifies the contents of an IORef strictly" $ do
+ ref <- newIORef 0
+ replicateM_ 1000000 . atomicModifyIORef' ref $ \n -> (n+1, ())
+ readIORef ref `shouldReturn` (1000000 :: Int)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Data/List/CompatSpec.hs new/base-compat-0.9.0/test/Data/List/CompatSpec.hs
--- old/base-compat-0.8.2/test/Data/List/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Data/List/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,43 @@
+module Data.List.CompatSpec (main, spec) where
+
+import Test.Hspec
+import Data.List.Compat
+
+data Asymmetric = A | B deriving Show
+
+instance Eq Asymmetric where
+ A == _ = True
+ B == _ = False
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "dropWhileEnd" $ do
+ it "drops the largest suffix of a list in which a predicate holds for all elements" $ do
+ dropWhileEnd (== ' ') "foo " `shouldBe` "foo"
+ dropWhileEnd (== ' ') "foo bar" `shouldBe` "foo bar"
+ describe "isSubsequenceOf" $ do
+ it "returns True if the first list is a subsequence of the second list" $ do
+ isSubsequenceOf "GHC" "The Glorious Haskell Compiler" `shouldBe` True
+ isSubsequenceOf "JHC" "The Glorious Haskell Compiler" `shouldBe` False
+ describe "nub" $
+ it "preserves the order of arguments to (==)" $
+ nub [A, B] `shouldBe` [A]
+ describe "nubBy" $
+ it "preserves the order of arguments to the equality function" $
+ nubBy (<) "12" `shouldBe` "1"
+ describe "sortOn" $ do
+ it "sorts a list by comparing the results of a key function applied to each element" $ do
+ sortOn (>='b') "cba" `shouldBe` "acb"
+ describe "uncons" $ do
+ it "decomposes a list into its head and tail" $ do
+ uncons "" `shouldBe` Nothing
+ uncons "12" `shouldBe` Just ('1', "2")
+ describe "union" $
+ it "nubs arguments in the same order as (==)" $ do
+ union [A] [A, B] `shouldBe` [A]
+ describe "unionBy" $
+ it "nubs arguments in the same order as nubBy's equality function" $ do
+ unionBy (<) "1" "21" `shouldBe` "11"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Data/Monoid/CompatSpec.hs new/base-compat-0.9.0/test/Data/Monoid/CompatSpec.hs
--- old/base-compat-0.8.2/test/Data/Monoid/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Data/Monoid/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,16 @@
+module Data.Monoid.CompatSpec (main, spec) where
+
+import Test.Hspec
+import Test.QuickCheck
+
+import Data.Monoid.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "<>" $ do
+ it "is an infix synonym for mappend" $ do
+ property $ \xs ys -> do
+ xs <> ys `shouldBe` (mappend xs ys :: String)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Data/STRef/CompatSpec.hs new/base-compat-0.9.0/test/Data/STRef/CompatSpec.hs
--- old/base-compat-0.8.2/test/Data/STRef/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Data/STRef/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,19 @@
+module Data.STRef.CompatSpec (main, spec) where
+
+import Test.Hspec
+
+import Control.Monad
+import Control.Monad.ST
+import Data.STRef.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec =
+ describe "modifySTRef'" $
+ it "should mutate the contents of an STRef strictly" $
+ shouldBe (1000000 :: Int) $ runST $ do
+ ref <- newSTRef 0
+ replicateM_ 1000000 $ modifySTRef' ref (+1)
+ readSTRef ref
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Data/Version/CompatSpec.hs new/base-compat-0.9.0/test/Data/Version/CompatSpec.hs
--- old/base-compat-0.8.2/test/Data/Version/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Data/Version/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,10 @@
+module Data.Version.CompatSpec (spec) where
+
+import Test.Hspec
+import Data.Version.Compat
+
+spec :: Spec
+spec = do
+ describe "makeVersion" $
+ it "constructs a tagless Version" $
+ makeVersion [1,2,3] `shouldBe` Version [1,2,3] []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Data/Word/CompatSpec.hs new/base-compat-0.9.0/test/Data/Word/CompatSpec.hs
--- old/base-compat-0.8.2/test/Data/Word/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Data/Word/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,22 @@
+module Data.Word.CompatSpec (main, spec) where
+
+import Test.Hspec
+import Data.Word.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "byteSwap16" $
+ it "reverses the order of bytes in a Word16 value" $ do
+ byteSwap16 0x1100 `shouldBe` 0x0011
+ byteSwap16 0x1010 `shouldBe` 0x1010
+ describe "byteSwap32" $
+ it "reverses the order of bytes in a Word32 value" $ do
+ byteSwap32 0x11001010 `shouldBe` 0x10100011
+ byteSwap32 0x10101111 `shouldBe` 0x11111010
+ describe "byteSwap64" $
+ it "reverses the order of bytes in a Word64 value" $ do
+ byteSwap64 0x1010111110101111 `shouldBe` 0x1111101011111010
+ byteSwap64 0x1100000000000011 `shouldBe` 0x1100000000000011
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Foreign/Marshal/Alloc/CompatSpec.hs new/base-compat-0.9.0/test/Foreign/Marshal/Alloc/CompatSpec.hs
--- old/base-compat-0.8.2/test/Foreign/Marshal/Alloc/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Foreign/Marshal/Alloc/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,17 @@
+module Foreign.Marshal.Alloc.CompatSpec (main, spec) where
+
+import Test.Hspec
+
+import Control.Exception
+import Foreign.Marshal.Alloc.Compat
+import Foreign.Storable
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "calloc" $
+ it "allocates memory with bytes of value zero" $ do
+ bracket calloc free $ \ptr -> do
+ peek ptr `shouldReturn` (0 :: Int)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Foreign/Marshal/Utils/CompatSpec.hs new/base-compat-0.9.0/test/Foreign/Marshal/Utils/CompatSpec.hs
--- old/base-compat-0.8.2/test/Foreign/Marshal/Utils/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Foreign/Marshal/Utils/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,20 @@
+module Foreign.Marshal.Utils.CompatSpec (main, spec) where
+
+import Test.Hspec
+
+import Foreign.Marshal.Alloc
+import Foreign.Marshal.Utils.Compat
+import Foreign.Ptr
+import Foreign.Storable
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "fillBytes" $
+ it "fills a given number of bytes in memory area with a byte value" $ do
+ alloca $ \ptr -> do
+ let _ = ptr :: Ptr Int
+ fillBytes ptr 0 $ sizeOf ptr
+ peek ptr `shouldReturn` 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Numeric/CompatSpec.hs new/base-compat-0.9.0/test/Numeric/CompatSpec.hs
--- old/base-compat-0.8.2/test/Numeric/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Numeric/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,24 @@
+module Numeric.CompatSpec (main, spec) where
+
+import Test.Hspec
+import Numeric.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "showFFloatAlt" $ do
+ it "shows a RealFloat value, always using decimal notation" $
+ showFFloatAlt Nothing (12 :: Double) "" `shouldBe` "12.0"
+ it "allows to specify the number of decimal places" $
+ showFFloatAlt (Just 4) (12 :: Double) "" `shouldBe` "12.0000"
+ describe "showGFloatAlt" $ do
+ it "shows a RealFloat value, using decimal notation if the absolute value lies between 0.1 and 9,999,999" $
+ showGFloatAlt Nothing (12 :: Double) "" `shouldBe` "12.0"
+ it "shows a RealFloat value, using decimal notation and specifying the number of decimal places" $
+ showGFloatAlt (Just 4) (12 :: Double) "" `shouldBe` "12.0000"
+ it "shows a RealFloat value, using scientific notation if the absolute value falls outside of the range" $
+ showGFloatAlt Nothing (1234567890 :: Double) "" `shouldBe` "1.23456789e9"
+ it "shows a RealFloat value, using scientific notation and specifying the number of decimal places" $
+ showGFloatAlt (Just 4) (1234567890 :: Double) "" `shouldBe` "1.2346e9"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/System/Environment/CompatSpec.hs new/base-compat-0.9.0/test/System/Environment/CompatSpec.hs
--- old/base-compat-0.8.2/test/System/Environment/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/System/Environment/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,120 @@
+{-# LANGUAGE CPP #-}
+module System.Environment.CompatSpec (main, spec) where
+
+import Test.Hspec
+import Test.QuickCheck
+
+import qualified Control.Exception as E
+import GHC.IO.Exception (IOErrorType (InvalidArgument))
+import System.Environment.Compat
+import System.IO.Error
+
+main :: IO ()
+main = hspec spec
+
+withEnv :: String -> String -> IO a -> IO a
+withEnv k v action = E.bracket save restore $ \_ -> do
+ setEnv k v >> action
+ where
+ save = lookupEnv k
+ restore = maybe (unsetEnv k) (setEnv k)
+
+withoutEnv :: String -> IO a -> IO a
+withoutEnv k action = E.bracket save restore $ \_ -> do
+ unsetEnv k >> action
+ where
+ save = lookupEnv k
+ restore = maybe (unsetEnv k) (setEnv k)
+
+spec :: Spec
+spec = do
+ describe "lookupEnv" $ do
+ it "returns specified environment variable" $ do
+ withEnv "FOOBAR" "23" $ do
+ lookupEnv "FOOBAR" `shouldReturn` Just "23"
+
+ it "returns Nothing if specified environment variable is not set" $ do
+ withoutEnv "FOOBAR" $ do
+ lookupEnv "FOOBAR" `shouldReturn` Nothing
+
+ describe "unsetEnv" $ do
+ it "removes specified environment variable" $ do
+ setEnv "FOO" "foo"
+ unsetEnv "FOO"
+ getEnv "FOO" `shouldThrow` isDoesNotExistError
+
+ it "does nothing if specified environment variable is not set" $ do
+ unsetEnv "BAR"
+ unsetEnv "BAR"
+ getEnv "BAR" `shouldThrow` isDoesNotExistError
+
+ it "throws an exception if key is the empty string" $ do
+ unsetEnv "" `shouldThrow` (== InvalidArgument) . ioeGetErrorType
+
+ it "throws an exception if key contains '='" $ do
+ unsetEnv "some=key" `shouldThrow` (== InvalidArgument) . ioeGetErrorType
+
+ it "works for arbitrary keys" $
+ property $ \k -> ('\NUL' `notElem` k && '=' `notElem` k && (not . null) k) ==> do
+ setEnv k "foo"
+ unsetEnv k
+ getEnv k `shouldThrow` isDoesNotExistError
+
+ describe "setEnv" $ do
+ it "sets specified environment variable to given value" $ do
+ unsetEnv "FOO"
+ setEnv "FOO" "foo"
+ getEnv "FOO" `shouldReturn` "foo"
+
+ it "resets specified environment variable, if it is already set" $ do
+ unsetEnv "FOO"
+ setEnv "FOO" "foo"
+ setEnv "FOO" "bar"
+ getEnv "FOO" `shouldReturn` "bar"
+
+ it "removes specified environment variable when value is the empty string" $ do
+ setEnv "FOO" "foo"
+ setEnv "FOO" ""
+ getEnv "FOO" `shouldThrow` isDoesNotExistError
+
+ it "removes specified environment variable when first character of value is NUL" $ do
+ setEnv "FOO" "foo"
+ setEnv "FOO" "\NULfoo"
+ getEnv "FOO" `shouldThrow` isDoesNotExistError
+
+ it "truncates value at NUL character" $ do
+ unsetEnv "FOO"
+ setEnv "FOO" "foo\NULbar"
+ getEnv "FOO" `shouldReturn` "foo"
+
+ it "truncates key at NUL character" $ do
+ unsetEnv "FOO"
+ setEnv "FOO\NULBAR" "foo"
+ getEnv "FOO" `shouldReturn` "foo"
+
+#if __GLASGOW_HASKELL__ >= 702
+ it "works for unicode" $ do
+ unsetEnv "FOO"
+ setEnv "FOO" "foo-\955-bar"
+ getEnv "FOO" `shouldReturn` "foo-\955-bar"
+#endif
+
+ it "works for arbitrary values" $
+ property $ \v -> ('\NUL' `notElem` v && (not . null) v) ==> do
+ setEnv "FOO" v
+ getEnv "FOO" `shouldReturn` v
+
+ it "works for unicode keys" $ do
+ setEnv "foo-\955-bar" "foo"
+ getEnv "foo-\955-bar" `shouldReturn` "foo"
+
+ it "throws an exception if key is the empty string" $ do
+ setEnv "" "foo" `shouldThrow` (== InvalidArgument) . ioeGetErrorType
+
+ it "throws an exception if key contains '='" $ do
+ setEnv "some=key" "foo" `shouldThrow` (== InvalidArgument) . ioeGetErrorType
+
+ it "works for arbitrary keys" $
+ property $ \k -> ('\NUL' `notElem` k && '=' `notElem` k && (not . null) k) ==> do
+ setEnv k "foo"
+ getEnv k `shouldReturn` "foo"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-compat-0.8.2/test/Text/Read/CompatSpec.hs new/base-compat-0.9.0/test/Text/Read/CompatSpec.hs
--- old/base-compat-0.8.2/test/Text/Read/CompatSpec.hs 1970-01-01 01:00:00.000000000 +0100
+++ new/base-compat-0.9.0/test/Text/Read/CompatSpec.hs 2016-01-15 03:45:49.000000000 +0100
@@ -0,0 +1,24 @@
+module Text.Read.CompatSpec (main, spec) where
+
+import Test.Hspec
+
+import Text.Read.Compat
+
+main :: IO ()
+main = hspec spec
+
+spec :: Spec
+spec = do
+ describe "readMaybe" $ do
+ it "parses a value" $ do
+ readMaybe "23" `shouldBe` (Just 23 :: Maybe Int)
+
+ it "returns Nothing if parsing fails" $ do
+ readMaybe "xx" `shouldBe` (Nothing :: Maybe Int)
+
+ describe "readEither" $ do
+ it "parses a value" $ do
+ readEither "23" `shouldBe` (Right 23 :: Either String Int)
+
+ it "returns Left if parsing fails" $ do
+ readEither "xx" `shouldBe` (Left "Prelude.read: no parse" :: Either String Int)
1
0
Hello community,
here is the log from the commit of package ghc-base-orphans for openSUSE:Factory checked in at 2016-01-28 17:23:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-base-orphans (Old)
and /work/SRC/openSUSE:Factory/.ghc-base-orphans.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-base-orphans"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-base-orphans/ghc-base-orphans.changes 2015-12-23 08:50:12.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-base-orphans.new/ghc-base-orphans.changes 2016-01-28 17:24:30.000000000 +0100
@@ -1,0 +2,6 @@
+Wed Jan 20 08:48:09 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 0.5.0
+* Backported instances introduced in GHC 8.0/base-4.9
+
+-------------------------------------------------------------------
Old:
----
base-orphans-0.4.5.tar.gz
New:
----
base-orphans-0.5.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-base-orphans.spec ++++++
--- /var/tmp/diff_new_pack.HLOfB0/_old 2016-01-28 17:24:30.000000000 +0100
+++ /var/tmp/diff_new_pack.HLOfB0/_new 2016-01-28 17:24:30.000000000 +0100
@@ -20,7 +20,7 @@
%bcond_with tests
Name: ghc-base-orphans
-Version: 0.4.5
+Version: 0.5.0
Release: 0
Summary: Backwards-compatible orphan instances for base
Group: System/Libraries
++++++ base-orphans-0.4.5.tar.gz -> base-orphans-0.5.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-orphans-0.4.5/CHANGES.markdown new/base-orphans-0.5.0/CHANGES.markdown
--- old/base-orphans-0.4.5/CHANGES.markdown 2015-12-15 18:26:53.000000000 +0100
+++ new/base-orphans-0.5.0/CHANGES.markdown 2016-01-15 03:45:07.000000000 +0100
@@ -1,3 +1,8 @@
+## Changes in 0.5.0
+ - GHC 8.0 compatibility
+ - Backported instances introduced in GHC 8.0/`base-4.9`
+ (see https://github.com/haskell-compat/base-orphans/issues/32)
+
## Changes in 0.4.5
- Import `Control.Monad.Instances` (which exports `Functor` and `Monad`
instances for `(->) r`, and `Functor` instances for `(,) a` and `Either a`)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-orphans-0.4.5/README.markdown new/base-orphans-0.5.0/README.markdown
--- old/base-orphans-0.4.5/README.markdown 2015-12-15 18:26:53.000000000 +0100
+++ new/base-orphans-0.5.0/README.markdown 2016-01-15 03:45:07.000000000 +0100
@@ -31,25 +31,33 @@
## What is covered
- * Added `Applicative` and `Alternative` instances for `ReadP` and `ReadPrec`
- * Added `Bits`, `Bounded`, and `Integral` instances for `CDev`
- * Added `Eq` and `Ord` instances for `Control.Exception.ErrorCall`
- * Added `Eq`, `Ord`, `Read`, and `Show` instances for data types in `GHC.Generics`
- * Added `Functor`, `Applicative`, `Alternative`, and `MonadPlus` instances for `ArrowMonad`
- * Added `Functor`, `Applicative`, and `Monad` instances for `First` and `Last`
- * Added `Monoid`, `Eq`, `Ord`, `Read`, and `Show` instances for `Const`
- * Added `Read` and `Show` instances for `Down`
- * Added `Eq`, `Ord`, `Read`, and `Show` instances for `ZipList`
- * Added `Monad` instance for `WrappedMonad`
- * Added `Data` and `IsList` instances for `Version`
+ * `Applicative` and `Alternative` instances for `ReadP` and `ReadPrec`
* `Applicative` instance for strict and lazy `ST`
+ * `Applicative`, `Foldable`, `Functor`, `Monad`, and `Traversable` instances for `Complex`,
+ `Dual`, `First`, `Last`, `Product`, and `Sum`
* `Bits` instance for `Bool`
+ * `Bits`, `Bounded`, and `Integral` instances for `CDev`
+ * `Bounded`, `Enum`, `Ix`, and `Storable` instances for `Const` and `Identity`
+ * `Data` instances for `All` and `Any`
+ * `Data`, `MonadFix` and `MonadZip` instances for `Alt`, `Dual`, `First`, `Last`,
+ `Product`, and `Sum`
+ * `Data` and `IsList` instances for `Version`
+ * `Eq` and `Ord` instances for `Control.Exception.ErrorCall`
+ * `Eq`, `Ord`, `Read`, and `Show` instances for data types in `GHC.Generics`
+ * `Eq`, `Ord`, `Read`, `Show`, `Foldable`, and `Traversable` instances for `ZipList`
* `Foldable` instance for `Either`, `(,)` and `Const`
* `Functor` instance for `Handler`, `ArgOrder`, `OptDescr`, and `ArgDescr`
+ * `Functor`, `Applicative`, `Alternative`, and `MonadPlus` instances for `ArrowMonad`
+ * `Monad` instance for `(,)`
+ * `Monad` instance for `WrappedMonad`
+ * `MonadZip` instance for `Maybe`
+ * `Monoid`, `Eq`, `Ord`, `Read`, and `Show` instances for `Const`
+ * `Monoid` instances for `Identity` and `IO`
* `Num` instance for `Sum` and `Product`
* `Read` instance for `Fixed`
+ * `Read` and `Show` instances for `Down`
* `Show` instance for `Fingerprint`
- * `Storable` instance for `Complex` and `Ratio`
+ * `Storable` instance for `()`, `Complex`, and `Ratio`
* `Traversable` instance for `Either`, `(,)` and `Const`
* `Typeable` instance for most data types, typeclasses, and promoted data constructors (when possible)
@@ -60,9 +68,14 @@
[`Generics.Deriving.Instances`](https://hackage.haskell.org/package/generic-deriving-1.8.0/docs/Generics-Deriving-Instances.html)
module of the [`generic-deriving`](https://hackage.haskell.org/package/generic-deriving)
library.
+* The `Alternative IO` and `MonadPlus IO` instances. These can be found in the
+ [`Control.Monad.Trans.Error`](http://hackage.haskell.org/package/transformers-0.4.3.0/docs/src/Control-Monad-Trans-Error.html#line-69)
+ module of the [`transformers`](http://hackage.haskell.org/package/transformers) library.
## Supported versions of GHC/`base`
+ * `ghc-8.0.1` / `base-4.9.0.0`
+ * `ghc-7.10.3` / `base-4.8.2.0`
* `ghc-7.10.2` / `base-4.8.1.0`
* `ghc-7.10.1` / `base-4.8.0.0`
* `ghc-7.8.4` / `base-4.7.0.2`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-orphans-0.4.5/base-orphans.cabal new/base-orphans-0.5.0/base-orphans.cabal
--- old/base-orphans-0.4.5/base-orphans.cabal 2015-12-15 18:26:53.000000000 +0100
+++ new/base-orphans-0.5.0/base-orphans.cabal 2016-01-15 03:45:07.000000000 +0100
@@ -1,71 +1,71 @@
--- This file has been generated from package.yaml by hpack version 0.8.0.
---
--- see: https://github.com/sol/hpack
-
-name: base-orphans
-version: 0.4.5
-synopsis: Backwards-compatible orphan instances for base
-description: @base-orphans@ defines orphan instances that mimic instances available in later versions of @base@ to a wider (older) range of compilers. @base-orphans@ does not export anything except the orphan instances themselves and complements @<http://hackage.haskell.org/package/base-compat base-compat>@.
- See the README for what instances are covered: <https://github.com/haskell-compat/base-orphans#readme>. See also the <https://github.com/haskell-compat/base-orphans#what-is-not-covered what is not covered> section.
-category: Compatibility
-homepage: https://github.com/haskell-compat/base-orphans#readme
-bug-reports: https://github.com/haskell-compat/base-orphans/issues
-author: Simon Hengel <sol(a)typeful.net>,
- João Cristóvão <jmacristovao(a)gmail.com>,
- Ryan Scott <ryan.gl.scott(a)gmail.com>
-maintainer: Simon Hengel <sol(a)typeful.net>,
- João Cristóvão <jmacristovao(a)gmail.com>,
- Ryan Scott <ryan.gl.scott(a)gmail.com>
-copyright: (c) 2012-2015 Simon Hengel,
- (c) 2014 João Cristóvão,
- (c) 2015 Ryan Scott
-license: MIT
-license-file: LICENSE
-build-type: Simple
-cabal-version: >= 1.10
-
-extra-source-files:
- CHANGES.markdown
- README.markdown
-
-source-repository head
- type: git
- location: https://github.com/haskell-compat/base-orphans
-
-library
- hs-source-dirs:
- src
- ghc-options: -Wall
- build-depends:
- base >= 4.3 && < 5,
- ghc-prim
- exposed-modules:
- Data.Orphans
- other-modules:
- Data.Orphans.Prelude
- default-language: Haskell2010
-
-test-suite spec
- type: exitcode-stdio-1.0
- main-is: Spec.hs
- hs-source-dirs:
- test
- ghc-options: -Wall
- build-depends:
- base >= 4.3 && < 5,
- base-orphans,
- hspec == 2.*,
- QuickCheck
- other-modules:
- Control.Applicative.OrphansSpec
- Control.Exception.OrphansSpec
- Data.Bits.OrphansSpec
- Data.Foldable.OrphansSpec
- Data.Monoid.OrphansSpec
- Data.Traversable.OrphansSpec
- Data.Version.OrphansSpec
- Foreign.Storable.OrphansSpec
- GHC.Fingerprint.OrphansSpec
- System.Posix.Types.IntWord
- System.Posix.Types.OrphansSpec
- default-language: Haskell2010
+-- This file has been generated from package.yaml by hpack version 0.8.0.
+--
+-- see: https://github.com/sol/hpack
+
+name: base-orphans
+version: 0.5.0
+synopsis: Backwards-compatible orphan instances for base
+description: @base-orphans@ defines orphan instances that mimic instances available in later versions of @base@ to a wider (older) range of compilers. @base-orphans@ does not export anything except the orphan instances themselves and complements @<http://hackage.haskell.org/package/base-compat base-compat>@.
+ See the README for what instances are covered: <https://github.com/haskell-compat/base-orphans#readme>. See also the <https://github.com/haskell-compat/base-orphans#what-is-not-covered what is not covered> section.
+category: Compatibility
+homepage: https://github.com/haskell-compat/base-orphans#readme
+bug-reports: https://github.com/haskell-compat/base-orphans/issues
+author: Simon Hengel <sol(a)typeful.net>,
+ João Cristóvão <jmacristovao(a)gmail.com>,
+ Ryan Scott <ryan.gl.scott(a)gmail.com>
+maintainer: Simon Hengel <sol(a)typeful.net>,
+ João Cristóvão <jmacristovao(a)gmail.com>,
+ Ryan Scott <ryan.gl.scott(a)gmail.com>
+copyright: (c) 2012-2015 Simon Hengel,
+ (c) 2014 João Cristóvão,
+ (c) 2015 Ryan Scott
+license: MIT
+license-file: LICENSE
+build-type: Simple
+cabal-version: >= 1.10
+
+extra-source-files:
+ CHANGES.markdown
+ README.markdown
+
+source-repository head
+ type: git
+ location: https://github.com/haskell-compat/base-orphans
+
+library
+ hs-source-dirs:
+ src
+ ghc-options: -Wall
+ build-depends:
+ base >= 4.3 && < 5,
+ ghc-prim
+ exposed-modules:
+ Data.Orphans
+ other-modules:
+ Data.Orphans.Prelude
+ default-language: Haskell2010
+
+test-suite spec
+ type: exitcode-stdio-1.0
+ main-is: Spec.hs
+ hs-source-dirs:
+ test
+ ghc-options: -Wall
+ build-depends:
+ base >= 4.3 && < 5,
+ base-orphans,
+ hspec == 2.*,
+ QuickCheck
+ other-modules:
+ Control.Applicative.OrphansSpec
+ Control.Exception.OrphansSpec
+ Data.Bits.OrphansSpec
+ Data.Foldable.OrphansSpec
+ Data.Monoid.OrphansSpec
+ Data.Traversable.OrphansSpec
+ Data.Version.OrphansSpec
+ Foreign.Storable.OrphansSpec
+ GHC.Fingerprint.OrphansSpec
+ System.Posix.Types.IntWord
+ System.Posix.Types.OrphansSpec
+ default-language: Haskell2010
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-orphans-0.4.5/src/Data/Orphans/Prelude.hs new/base-orphans-0.5.0/src/Data/Orphans/Prelude.hs
--- old/base-orphans-0.4.5/src/Data/Orphans/Prelude.hs 2015-12-15 18:26:53.000000000 +0100
+++ new/base-orphans-0.5.0/src/Data/Orphans/Prelude.hs 2016-01-15 03:45:07.000000000 +0100
@@ -10,7 +10,7 @@
Note that this module does not export any modules that could introduce name clashes.
-}
module Data.Orphans.Prelude
-#if MIN_VERSION_base(4,8,0)
+#if MIN_VERSION_base(4,9,0)
() where
#else
(module OrphansPrelude) where
@@ -100,4 +100,8 @@
import Control.Concurrent.SampleVar as OrphansPrelude
# endif
+# if MIN_VERSION_base(4,8,0)
+import Data.Functor.Identity as OrphansPrelude
+# endif
+
#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/base-orphans-0.4.5/src/Data/Orphans.hs new/base-orphans-0.5.0/src/Data/Orphans.hs
--- old/base-orphans-0.4.5/src/Data/Orphans.hs 2015-12-15 18:26:53.000000000 +0100
+++ new/base-orphans-0.5.0/src/Data/Orphans.hs 2016-01-15 03:45:07.000000000 +0100
@@ -5,6 +5,7 @@
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
@@ -42,13 +43,16 @@
import Control.Monad.Instances ()
#endif
-#if __GLASGOW_HASKELL__ < 710
-import Control.Exception as Exception
-import Control.Monad.ST.Lazy as Lazy
+#if !(MIN_VERSION_base(4,9,0))
import Data.Data as Data
import qualified Data.Foldable as F (Foldable(..))
import Data.Monoid as Monoid
import qualified Data.Traversable as T (Traversable(..))
+#endif
+
+#if __GLASGOW_HASKELL__ < 710
+import Control.Exception as Exception
+import Control.Monad.ST.Lazy as Lazy
import GHC.Exts as Exts
import GHC.IO.Exception as Exception
import Text.ParserCombinators.ReadP as ReadP
@@ -60,7 +64,7 @@
# endif
#endif
-#if !(MIN_VERSION_base(4,8,0))
+#if !(MIN_VERSION_base(4,9,0))
import Data.Orphans.Prelude
#endif
@@ -392,6 +396,242 @@
pokeElemOff q 1 i
#endif
+#if !(MIN_VERSION_base(4,9,0))
+instance Storable () where
+ sizeOf _ = 0
+ alignment _ = 1
+ peek _ = return ()
+ poke _ _ = return ()
+
+deriving instance Bounded a => Bounded (Const a b)
+deriving instance Enum a => Enum (Const a b)
+deriving instance Ix a => Ix (Const a b)
+deriving instance Storable a => Storable (Const a b)
+
+deriving instance Data All
+deriving instance Data Monoid.Any
+deriving instance Data a => Data (Dual a)
+deriving instance Data a => Data (First a)
+deriving instance Data a => Data (Last a)
+deriving instance Data a => Data (Product a)
+deriving instance Data a => Data (Sum a)
+
+instance F.Foldable Dual where
+ foldMap = coerce
+
+ foldl = coerce
+ foldl1 _ = getDual
+ foldr f z (Dual x) = f x z
+ foldr1 _ = getDual
+# if MIN_VERSION_base(4,6,0)
+ foldl' = coerce
+ foldr' = F.foldr
+# endif
+# if MIN_VERSION_base(4,8,0)
+ elem = (. getDual) #. (==)
+ length _ = 1
+ maximum = getDual
+ minimum = getDual
+ null _ = False
+ product = getDual
+ sum = getDual
+ toList (Dual x) = [x]
+# endif
+
+instance F.Foldable Sum where
+ foldMap = coerce
+
+ foldl = coerce
+ foldl1 _ = getSum
+ foldr f z (Sum x) = f x z
+ foldr1 _ = getSum
+# if MIN_VERSION_base(4,6,0)
+ foldl' = coerce
+ foldr' = F.foldr
+# endif
+# if MIN_VERSION_base(4,8,0)
+ elem = (. getSum) #. (==)
+ length _ = 1
+ maximum = getSum
+ minimum = getSum
+ null _ = False
+ product = getSum
+ sum = getSum
+ toList (Sum x) = [x]
+# endif
+
+instance F.Foldable Product where
+ foldMap = coerce
+
+ foldl = coerce
+ foldl1 _ = getProduct
+ foldr f z (Product x) = f x z
+ foldr1 _ = getProduct
+# if MIN_VERSION_base(4,6,0)
+ foldl' = coerce
+ foldr' = F.foldr
+# endif
+# if MIN_VERSION_base(4,8,0)
+ elem = (. getProduct) #. (==)
+ length _ = 1
+ maximum = getProduct
+ minimum = getProduct
+ null _ = False
+ product = getProduct
+ sum = getProduct
+ toList (Product x) = [x]
+# endif
+
+# if MIN_VERSION_base(4,8,0)
+(#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c)
+(#.) _f = coerce
+# endif
+
+# if !(MIN_VERSION_base(4,7,0))
+coerce :: a -> b
+coerce = unsafeCoerce
+# endif
+
+instance Functor Dual where
+ fmap = coerce
+
+instance Applicative Dual where
+ pure = Dual
+ (<*>) = coerce
+
+instance Monad Dual where
+ return = Dual
+ m >>= k = k (getDual m)
+
+instance Functor Sum where
+ fmap = coerce
+
+instance Applicative Sum where
+ pure = Sum
+ (<*>) = coerce
+
+instance Monad Sum where
+ return = Sum
+ m >>= k = k (getSum m)
+
+instance Functor Product where
+ fmap = coerce
+
+instance Applicative Product where
+ pure = Product
+ (<*>) = coerce
+
+instance Monad Product where
+ return = Product
+ m >>= k = k (getProduct m)
+
+instance F.Foldable First where
+ foldMap f = F.foldMap f . getFirst
+
+instance F.Foldable Last where
+ foldMap f = F.foldMap f . getLast
+
+instance Monoid a => Monoid (IO a) where
+ mempty = pure mempty
+ mappend = liftA2 mappend
+
+-- see: #10190 https://git.haskell.org/ghc.git/commitdiff/9db005a444722e31aca1956b058e069b…
+instance Monoid a => Monad ((,) a) where
+ return x = (mempty, x)
+ (u, a) >>= k = case k a of (v, b) -> (u `mappend` v, b)
+
+instance MonadFix Dual where
+ mfix f = Dual (fix (getDual . f))
+
+instance MonadFix Sum where
+ mfix f = Sum (fix (getSum . f))
+
+instance MonadFix Product where
+ mfix f = Product (fix (getProduct . f))
+
+instance MonadFix First where
+ mfix f = First (mfix (getFirst . f))
+
+instance MonadFix Last where
+ mfix f = Last (mfix (getLast . f))
+
+instance T.Traversable Dual where
+ traverse f (Dual x) = Dual <$> f x
+
+instance T.Traversable Sum where
+ traverse f (Sum x) = Sum <$> f x
+
+instance T.Traversable Product where
+ traverse f (Product x) = Product <$> f x
+
+instance T.Traversable First where
+ traverse f (First x) = First <$> T.traverse f x
+
+instance T.Traversable Last where
+ traverse f (Last x) = Last <$> T.traverse f x
+
+deriving instance F.Foldable ZipList
+deriving instance T.Traversable ZipList
+
+# if MIN_VERSION_base(4,4,0)
+deriving instance Functor Complex
+deriving instance F.Foldable Complex
+deriving instance T.Traversable Complex
+
+instance Applicative Complex where
+ pure a = a :+ a
+ f :+ g <*> a :+ b = f a :+ g b
+
+instance Monad Complex where
+ return a = a :+ a
+ a :+ b >>= f = realPart (f a) :+ imagPart (f b)
+
+-- | Extracts the real part of a complex number.
+realPart :: Complex a -> a
+realPart (x :+ _) = x
+
+-- | Extracts the imaginary part of a complex number.
+imagPart :: Complex a -> a
+imagPart (_ :+ y) = y
+
+instance MonadZip Dual where
+ -- Cannot use coerce, it's unsafe
+ mzipWith = liftM2
+
+instance MonadZip Sum where
+ mzipWith = liftM2
+
+instance MonadZip Product where
+ mzipWith = liftM2
+
+instance MonadZip Maybe where
+ mzipWith = liftM2
+
+instance MonadZip First where
+ mzipWith = liftM2
+
+instance MonadZip Last where
+ mzipWith = liftM2
+# endif
+
+# if MIN_VERSION_base(4,8,0)
+deriving instance (Data (f a), Typeable f, Typeable a)
+ => Data (Alt (f :: * -> *) (a :: *))
+
+instance MonadFix f => MonadFix (Alt f) where
+ mfix f = Alt (mfix (getAlt . f))
+
+instance MonadZip f => MonadZip (Alt f) where
+ mzipWith f (Alt ma) (Alt mb) = Alt (mzipWith f ma mb)
+
+deriving instance Bounded a => Bounded (Identity a)
+deriving instance Enum a => Enum (Identity a)
+deriving instance Ix a => Ix (Identity a)
+deriving instance Monoid a => Monoid (Identity a)
+deriving instance Storable a => Storable (Identity a)
+# endif
+#endif
+
#if __GLASGOW_HASKELL__ < 710
deriving instance Typeable All
deriving instance Typeable AnnotationWrapper
1
0
Hello community,
here is the log from the commit of package ghc-async for openSUSE:Factory checked in at 2016-01-28 17:23:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-async (Old)
and /work/SRC/openSUSE:Factory/.ghc-async.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-async"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-async/ghc-async.changes 2015-05-21 08:11:04.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-async.new/ghc-async.changes 2016-01-28 17:24:28.000000000 +0100
@@ -1,0 +2,11 @@
+Sun Jan 24 10:10:44 UTC 2016 - mimi.vx(a)gmail.com
+
+- update to 2.1.0
+* Bump base dependency to allow 4.10
+* Remove invalid Monad instance for Concurrently
+* Add Monoid and Semigroup instances for Concurrently
+* Add forConcurrently (flipped version of mapConcurrently)
+* Add STM version of all applicable IO functions: waitAnySTM, waitAnyCatchSTM,
+ waitEitherSTM, waitEitherCatchSTM, waitEitherSTM_, and waitBothSTM.
+
+-------------------------------------------------------------------
Old:
----
async-2.0.2.tar.gz
New:
----
async-2.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-async.spec ++++++
--- /var/tmp/diff_new_pack.Fjk1y6/_old 2016-01-28 17:24:29.000000000 +0100
+++ /var/tmp/diff_new_pack.Fjk1y6/_new 2016-01-28 17:24:29.000000000 +0100
@@ -19,14 +19,14 @@
%global pkg_name async
Name: ghc-async
-Version: 2.0.2
+Version: 2.1.0
Release: 0
Summary: Run IO operations asynchronously and wait for their results
License: BSD-3-Clause
Group: System/Libraries
Url: http://hackage.haskell.org/package/%{pkg_name}
-Source0: http://hackage.haskell.org/packages/archive/%{pkg_name}/%{version}/%{pkg_na…
+Source0: http://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{ver…
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: ghc-Cabal-devel
++++++ async-2.0.2.tar.gz -> async-2.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/async-2.0.2/Control/Concurrent/Async.hs new/async-2.1.0/Control/Concurrent/Async.hs
--- old/async-2.0.2/Control/Concurrent/Async.hs 2014-12-22 12:32:14.000000000 +0100
+++ new/async-2.1.0/Control/Concurrent/Async.hs 2016-01-05 17:42:20.000000000 +0100
@@ -105,11 +105,17 @@
waitEither_,
waitBoth,
+ -- ** Waiting for multiple 'Async's in STM
+ waitAnySTM, waitAnyCatchSTM,
+ waitEitherSTM, waitEitherCatchSTM,
+ waitEitherSTM_,
+ waitBothSTM,
+
-- ** Linking
link, link2,
-- * Convenient utilities
- race, race_, concurrently, mapConcurrently,
+ race, race_, concurrently, mapConcurrently, forConcurrently,
Concurrently(..),
) where
@@ -122,7 +128,14 @@
#endif
import Control.Monad
import Control.Applicative
+#if !MIN_VERSION_base(4,8,0)
+import Data.Monoid (Monoid(mempty,mappend))
import Data.Traversable
+#endif
+#if MIN_VERSION_base(4,9,0)
+import Data.Semigroup (Semigroup((<>)))
+#endif
+
import GHC.Exts
import GHC.IO hiding (finally, onException)
@@ -316,9 +329,15 @@
-- If multiple 'Async's complete or have completed, then the value
-- returned corresponds to the first completed 'Async' in the list.
--
+{-# INLINE waitAnyCatch #-}
waitAnyCatch :: [Async a] -> IO (Async a, Either SomeException a)
-waitAnyCatch asyncs =
- atomically $
+waitAnyCatch = atomically . waitAnyCatchSTM
+
+-- | A version of 'waitAnyCatch' that can be used inside an STM transaction.
+--
+-- @since 2.1.0
+waitAnyCatchSTM :: [Async a] -> STM (Async a, Either SomeException a)
+waitAnyCatchSTM asyncs =
foldr orElse retry $
map (\a -> do r <- waitCatchSTM a; return (a, r)) asyncs
@@ -336,9 +355,15 @@
-- If multiple 'Async's complete or have completed, then the value
-- returned corresponds to the first completed 'Async' in the list.
--
+{-# INLINE waitAny #-}
waitAny :: [Async a] -> IO (Async a, a)
-waitAny asyncs =
- atomically $
+waitAny = atomically . waitAnySTM
+
+-- | A version of 'waitAny' that can be used inside an STM transaction.
+--
+-- @since 2.1.0
+waitAnySTM :: [Async a] -> STM (Async a, a)
+waitAnySTM asyncs =
foldr orElse retry $
map (\a -> do r <- waitSTM a; return (a, r)) asyncs
@@ -350,11 +375,19 @@
waitAny asyncs `finally` mapM_ cancel asyncs
-- | Wait for the first of two @Async@s to finish.
+{-# INLINE waitEitherCatch #-}
waitEitherCatch :: Async a -> Async b
-> IO (Either (Either SomeException a)
(Either SomeException b))
-waitEitherCatch left right =
- atomically $
+waitEitherCatch left right = atomically (waitEitherCatchSTM left right)
+
+-- | A version of 'waitEitherCatch' that can be used inside an STM transaction.
+--
+-- @since 2.1.0
+waitEitherCatchSTM :: Async a -> Async b
+ -> STM (Either (Either SomeException a)
+ (Either SomeException b))
+waitEitherCatchSTM left right =
(Left <$> waitCatchSTM left)
`orElse`
(Right <$> waitCatchSTM right)
@@ -372,18 +405,30 @@
-- that finished first raised an exception, then the exception is
-- re-thrown by 'waitEither'.
--
+{-# INLINE waitEither #-}
waitEither :: Async a -> Async b -> IO (Either a b)
-waitEither left right =
- atomically $
+waitEither left right = atomically (waitEitherSTM left right)
+
+-- | A version of 'waitEither' that can be used inside an STM transaction.
+--
+-- @since 2.1.0
+waitEitherSTM :: Async a -> Async b -> STM (Either a b)
+waitEitherSTM left right =
(Left <$> waitSTM left)
`orElse`
(Right <$> waitSTM right)
-- | Like 'waitEither', but the result is ignored.
--
+{-# INLINE waitEither_ #-}
waitEither_ :: Async a -> Async b -> IO ()
-waitEither_ left right =
- atomically $
+waitEither_ left right = atomically (waitEitherSTM_ left right)
+
+-- | A version of 'waitEither_' that can be used inside an STM transaction.
+--
+-- @since 2.1.0
+waitEitherSTM_:: Async a -> Async b -> STM ()
+waitEitherSTM_ left right =
(void $ waitSTM left)
`orElse`
(void $ waitSTM right)
@@ -399,9 +444,15 @@
-- an exception before they have both finished, then the exception is
-- re-thrown by 'waitBoth'.
--
+{-# INLINE waitBoth #-}
waitBoth :: Async a -> Async b -> IO (a,b)
-waitBoth left right =
- atomically $ do
+waitBoth left right = atomically (waitBothSTM left right)
+
+-- | A version of 'waitBoth' that can be used inside an STM transaction.
+--
+-- @since 2.1.0
+waitBothSTM :: Async a -> Async b -> STM (a,b)
+waitBothSTM left right = do
a <- waitSTM left
`orElse`
(waitSTM right >> retry)
@@ -519,7 +570,9 @@
`catchAll` (putMVar done . Left)
rid <- forkIO $ restore (right >>= putMVar done . Right . Right)
`catchAll` (putMVar done . Left)
- let stop = killThread lid >> killThread rid
+ let stop = killThread rid >> killThread lid
+ -- kill right before left, to match the semantics of
+ -- the version using withAsync. (#27)
r <- restore (collect done) `onException` stop
stop
return r
@@ -538,6 +591,14 @@
mapConcurrently :: Traversable t => (a -> IO b) -> t a -> IO (t b)
mapConcurrently f = runConcurrently . traverse (Concurrently . f)
+-- | `forConcurrently` is `mapConcurrently` with its arguments flipped
+--
+-- > pages <- forConcurrently ["url1", "url2", "url3"] $ \url -> getURL url
+--
+-- @since 2.1.0
+forConcurrently :: Traversable t => t a -> (a -> IO b)-> IO (t b)
+forConcurrently = flip mapConcurrently
+
-- -----------------------------------------------------------------------------
-- | A value of type @Concurrently a@ is an @IO@ operation that can be
@@ -571,10 +632,23 @@
Concurrently as <|> Concurrently bs =
Concurrently $ either id id <$> race as bs
-instance Monad Concurrently where
- return = pure
- Concurrently a >>= f =
- Concurrently $ a >>= runConcurrently . f
+#if MIN_VERSION_base(4,9,0)
+-- | Only defined by @async@ for @base >= 4.9@
+--
+-- @since 2.1.0
+instance Semigroup a => Semigroup (Concurrently a) where
+ (<>) = liftA2 (<>)
+
+-- | @since 2.1.0
+instance (Semigroup a, Monoid a) => Monoid (Concurrently a) where
+ mempty = pure mempty
+ mappend = (<>)
+#else
+-- | @since 2.1.0
+instance Monoid a => Monoid (Concurrently a) where
+ mempty = pure mempty
+ mappend = liftA2 mappend
+#endif
-- ----------------------------------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/async-2.0.2/async.cabal new/async-2.1.0/async.cabal
--- old/async-2.0.2/async.cabal 2014-12-22 12:32:14.000000000 +0100
+++ new/async-2.1.0/async.cabal 2016-01-05 17:42:20.000000000 +0100
@@ -1,4 +1,6 @@
name: async
+version: 2.1.0
+-- don't forget to update ./changelog.md!
synopsis: Run IO operations asynchronously and wait for their results
description:
@@ -21,47 +23,7 @@
* The API makes it possible to build a tree of
threads that are automatically killed when
their parent dies (see 'withAsync').
- .
- Changes in 2.0.2:
- .
- * Add a Monad instance for Concurrently
- * Bump base dependency to allow 4.9
- .
- Changes in 2.0.1.6:
- .
- * Add workaround to waitCatch for #14
- .
- Changes in 2.0.1.5:
- .
- * Bump @base@ dependencies for GHC 7.8
- .
- Changes in 2.0.1.4:
- .
- * Bump @base@ dependency of test suite
- .
- Changes in 2.0.1.3:
- .
- * Bump @base@ dependency to allow 4.6
- .
- Changes in 2.0.1.2:
- .
- * Bump @stm@ dependency to 2.4
- .
- Changes in 2.0.1.1:
- .
- * Safe Haskell support: @Control.Concurrent.Async@ is now @Trustworthy@
- .
- Changes in 2.0.1.0:
- .
- * Added a @Functor@ instance for @Async@
- .
- * Added @asyncBound@, @asyncOn@, @asyncWithUnmask@, @asyncOnWithUnmask@, @withAsyncBound@, @withAsyncOn@, @withAsyncWithUnmask@, @withAsyncOnWithUnmask@.
- .
- * Added @mapConcurrently@
- .
- * Added @Concurrently@ (with @Applicative@ and @Alternative@ instances)
-version: 2.0.2
license: BSD3
license-file: LICENSE
author: Simon Marlow
@@ -69,12 +31,13 @@
copyright: (c) Simon Marlow 2012
category: Concurrency
build-type: Simple
-cabal-version: >=1.8
+cabal-version: >=1.10
homepage: https://github.com/simonmar/async
bug-reports: https://github.com/simonmar/async/issues
-tested-with: GHC==7.0.3, GHC==7.2.2, GHC==7.4.1
+tested-with: GHC==7.11.*, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2, GHC==7.0.4
extra-source-files:
+ changelog.md
bench/race.hs
source-repository head
@@ -82,14 +45,19 @@
location: https://github.com/simonmar/async.git
library
+ default-language: Haskell2010
+ other-extensions: CPP, MagicHash, RankNTypes, UnboxedTuples
+ if impl(ghc>=7.1)
+ other-extensions: Trustworthy
exposed-modules: Control.Concurrent.Async
- build-depends: base >= 4.3 && < 4.9, stm >= 2.2 && < 2.5
+ build-depends: base >= 4.3 && < 4.10, stm >= 2.2 && < 2.5
test-suite test-async
+ default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: test-async.hs
- build-depends: base >= 4.3 && < 4.9,
+ build-depends: base >= 4.3 && < 4.10,
async,
test-framework,
test-framework-hunit,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/async-2.0.2/changelog.md new/async-2.1.0/changelog.md
--- old/async-2.0.2/changelog.md 1970-01-01 01:00:00.000000000 +0100
+++ new/async-2.1.0/changelog.md 2016-01-05 17:42:20.000000000 +0100
@@ -0,0 +1,45 @@
+## Changes in 2.1.0:
+
+ - Bump base dependency to allow 4.10
+ - Remove invalid Monad instance for `Concurrently`
+ - Add `Monoid` and `Semigroup` instances for `Concurrently`
+ - Add `forConcurrently` (flipped version of `mapConcurrently`)
+ - Add STM version of all applicable IO functions:
+ `waitAnySTM`, `waitAnyCatchSTM`, `waitEitherSTM`,
+ `waitEitherCatchSTM`, `waitEitherSTM_`, and `waitBothSTM`.
+
+## Changes in 2.0.2:
+
+ - Add a Monad instance for `Concurrently`
+ - Bump base dependency to allow 4.9
+
+## Changes in 2.0.1.6:
+
+ - Add workaround to waitCatch for #14
+
+## Changes in 2.0.1.5:
+
+ - Bump `base` dependencies for GHC 7.8
+
+## Changes in 2.0.1.4:
+
+ - Bump `base` dependency of test suite
+
+## Changes in 2.0.1.3:
+
+ - Bump `base` dependency to allow 4.6
+
+## Changes in 2.0.1.2:
+
+ - Bump `stm` dependency to 2.4
+
+## Changes in 2.0.1.1:
+
+ - Safe Haskell support: `Control.Concurrent.Async` is now `Trustworthy`
+
+## Changes in 2.0.1.0:
+
+ - Added a `Functor` instance for `Async`
+ - Added `asyncBound`, `asyncOn`, `asyncWithUnmask`, `asyncOnWithUnmask`, `withAsyncBound`, `withAsyncOn`, `withAsyncWithUnmask`, `withAsyncOnWithUnmask`.
+ - Added `mapConcurrently`
+ - Added `Concurrently` (with `Applicative` and `Alternative` instances)
1
0
Hello community,
here is the log from the commit of package ghc-aeson for openSUSE:Factory checked in at 2016-01-28 17:23:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-aeson (Old)
and /work/SRC/openSUSE:Factory/.ghc-aeson.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-aeson"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-aeson/ghc-aeson.changes 2016-01-08 15:22:37.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-aeson.new/ghc-aeson.changes 2016-01-28 17:24:27.000000000 +0100
@@ -2,50 +1,0 @@
-Wed Dec 23 15:40:06 UTC 2015 - mimi.vx(a)gmail.com
-
-- update to 0.10.0.0
-* Performance improvements:
- + Direct encoding via the new toEncoding method is over 2x faster than toJSON.
- (You must write or code-gen a toEncoding implementation to unlock this speedup.
- See below for details.)
- + Improved string decoding gives a 12% speed win in parsing string-heavy JSON
- payloads (very common).
- + Encoding and decoding of time-related types are 10x faster (!!) as a result of
- bypassing Data.Time.Format and the arbitrary-precision Integer type.
- + When using toEncoding, [Char] can be encoded without a conversion to Text.
- This is fast and efficient.
- + Parsing into an Object is now 5% faster and more allocation-efficient.
-* SUBTLE API CHANGES, READ CAREFULLY:
- + With the exception of long-deprecated code, the API changes below should be
- upwards compatible from older versions of aeson. If you run into upgrade
- problems, please file an issue with details.
- + The ToJSON class has a new method, toEncoding, that allows direct encoding
- from a Haskell value to a lazy bytestring without construction of an
- intermediate Value.
- + The performance benefits of direct encoding are significant: more than 2x
- faster than before, with less than 1/3 the memory usage.
- + To preserve API compatibility across upgrades from older versions of this
- library, the default implementation of toEncoding uses toJSON. You will not
- see any performance improvement unless you write an implementation of
- toEncoding, which can be very simple:
- instance ToJSON Coord where
- toEncoding = genericToEncoding defaultOptions
- (Behind the scenes, the encode function uses toEncoding now, so if you
- implement toEncoding for your types, you should see a speedup immediately.)
- + If you use Template Haskell or GHC Generics to auto-generate your ToJSON
- instances, you'll benefit from fast toEncoding implementations for free!
- + When converting from a Value to a target Haskell type, FromJSON instances now
- provide much better error messages, including a complete JSON path from the
- root of the object to the offending element. This greatly eases debugging.
- + It is now possible to use Template Haskell to generate FromJSON and ToJSON
- instances for types in data families.
- + If you use Template Haskell or generics, and used to use the camelTo function
- to rename fields, the new camelTo2 function is smarter. For example, camelTo
- will rename CamelAPICase to camelapi_case (ugh!), while camelTo2 will map
- it to camel_api_case (yay!).
- + New ToJSON and FromJSON instances for the following time-related types: Day,
- LocalTime.
- + The Result type is now an instance of Foldable and Traversable.
- + The Data.Aeson.Generic module has been removed. It was deprecated in late 2013.
- + The instance of Monad for the Result type lacked an implementation of fail
- (oops). This has been corrected.
-
--------------------------------------------------------------------
Old:
----
aeson-0.10.0.0.tar.gz
New:
----
aeson-0.9.0.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-aeson.spec ++++++
--- /var/tmp/diff_new_pack.9IKUB4/_old 2016-01-28 17:24:28.000000000 +0100
+++ /var/tmp/diff_new_pack.9IKUB4/_new 2016-01-28 17:24:28.000000000 +0100
@@ -20,8 +20,8 @@
%bcond_with tests
-Name: ghc-aeson
-Version: 0.10.0.0
+Name: ghc-%{pkg_name}
+Version: 0.9.0.1
Release: 0
Summary: Fast JSON parsing and encoding
License: BSD-3-Clause
@@ -41,6 +41,7 @@
BuildRequires: ghc-dlist-devel
BuildRequires: ghc-hashable-devel
BuildRequires: ghc-mtl-devel
+BuildRequires: ghc-old-locale-devel
BuildRequires: ghc-scientific-devel
BuildRequires: ghc-syb-devel
BuildRequires: ghc-template-haskell-devel
++++++ aeson-0.10.0.0.tar.gz -> aeson-0.9.0.1.tar.gz ++++++
++++ 12680 lines of diff (skipped)
1
0
Hello community,
here is the log from the commit of package python-dfVFS for openSUSE:Factory checked in at 2016-01-28 17:23:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-dfVFS (Old)
and /work/SRC/openSUSE:Factory/.python-dfVFS.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-dfVFS"
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-dfVFS/python-dfVFS.changes 2015-08-21 12:43:03.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python-dfVFS.new/python-dfVFS.changes 2016-01-28 17:24:24.000000000 +0100
@@ -1,0 +2,9 @@
+Wed Dec 2 21:00:42 UTC 2015 - Greg.Freemyer(a)gmail.com
+
+- update to v0~20160108
+ * still pre-release and no ChangeLog available
+ * required by plaso v1.4.0 which is in feature freeze at this point
+- update pyvshadow requires to version v0~20160110
+- add Requires: pyfsntfs
+
+-------------------------------------------------------------------
Old:
----
dfvfs-20150708.tar.gz
New:
----
dfvfs-20160108.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-dfVFS.spec ++++++
--- /var/tmp/diff_new_pack.A9WWUQ/_old 2016-01-28 17:24:27.000000000 +0100
+++ /var/tmp/diff_new_pack.A9WWUQ/_new 2016-01-28 17:24:27.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-dfVFS
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,7 +16,7 @@
#
-%define timestamp 20150708
+%define timestamp 20160108
Name: python-dfVFS
Version: 0~%{timestamp}
Release: 0
@@ -31,6 +31,7 @@
BuildRequires: python-setuptools
Requires: pybde
Requires: pyewf
+Requires: pyfsntfs
Requires: pyqcow
Requires: pysigscan
Requires: pysmdev
@@ -41,7 +42,7 @@
Requires: pytsk
Requires: pyvhdi
Requires: pyvmdk
-Requires: pyvshadow
+Requires: pyvshadow >= 0~20160110
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
++++++ dfvfs-20150708.tar.gz -> dfvfs-20160108.tar.gz ++++++
/work/SRC/openSUSE:Factory/python-dfVFS/dfvfs-20150708.tar.gz /work/SRC/openSUSE:Factory/.python-dfVFS.new/dfvfs-20160108.tar.gz differ: char 5, line 1
1
0