Hello community, here is the log from the commit of package ghc-reflection for openSUSE:Factory checked in at 2016-01-07 00:25:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-reflection (Old) and /work/SRC/openSUSE:Factory/.ghc-reflection.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-reflection" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-reflection/ghc-reflection.changes 2015-10-06 13:24:09.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-reflection.new/ghc-reflection.changes 2016-01-07 00:25:15.000000000 +0100 @@ -1,0 +2,5 @@ +Tue Dec 15 10:33:17 UTC 2015 - [email protected] + +- update to 2.1 + +------------------------------------------------------------------- Old: ---- reflection-2.tar.gz New: ---- reflection-2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-reflection.spec ++++++ --- /var/tmp/diff_new_pack.nIvSyW/_old 2016-01-07 00:25:17.000000000 +0100 +++ /var/tmp/diff_new_pack.nIvSyW/_new 2016-01-07 00:25:17.000000000 +0100 @@ -18,7 +18,7 @@ %global pkg_name reflection Name: ghc-reflection -Version: 2 +Version: 2.1 Release: 0 Summary: Reifies arbitrary terms into types that can be reflected back into terms Group: System/Libraries ++++++ reflection-2.tar.gz -> reflection-2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2/README.markdown new/reflection-2.1/README.markdown --- old/reflection-2/README.markdown 2015-07-10 00:11:14.000000000 +0200 +++ new/reflection-2.1/README.markdown 2015-09-14 01:22:48.000000000 +0200 @@ -1,7 +1,7 @@ reflection ========== -[](http://travis-ci.org/ekmett/reflection) +[](https://hackage.haskell.org/package/reflection) [](http://travis-ci.org/ekmett/reflection) This package provides an implementation of the ideas presented in [Functional Pearl: Implicit Configurations](http://okmij.org/ftp/Haskell/tr-15-04.pdf) by Oleg Kiselyov and Chung-Chieh Shan. However, the API has been implemented in a much more efficient manner. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2/fast/Data/Reflection.hs new/reflection-2.1/fast/Data/Reflection.hs --- old/reflection-2/fast/Data/Reflection.hs 2015-07-10 00:11:14.000000000 +0200 +++ new/reflection-2.1/fast/Data/Reflection.hs 2015-09-14 01:22:48.000000000 +0200 @@ -87,34 +87,62 @@ #endif -- * Useful compile time naturals , Z, D, SD, PD + + -- * Reified Monoids + , ReifiedMonoid(..) + , ReflectedMonoid(..) + , reifyMonoid + , foldMapBy + , foldBy + + -- * Reified Applicatives + , ReifiedApplicative(..) + , ReflectedApplicative(..) + , reifyApplicative + , traverseBy + , sequenceBy ) where +import Control.Applicative + +#ifdef MIN_VERSION_template_haskell +import Control.Monad +#endif + +import Data.Bits + +#if __GLASGOW_HASKELL__ < 710 +import Data.Foldable +import Data.Monoid +#endif + import Data.Proxy -#if (defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707) || (defined(MIN_VERSION_template_haskell) && USE_TYPE_LITS) -import GHC.TypeLits +#if __GLASGOW_HASKELL__ < 710 +import Data.Traversable #endif -#ifdef MIN_VERSION_template_haskell -import Language.Haskell.TH hiding (reify) -import Control.Monad +import Data.Typeable +import Data.Word +import Foreign.Ptr +import Foreign.StablePtr + +#if (defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707) || (defined(MIN_VERSION_template_haskell) && USE_TYPE_LITS) +import GHC.TypeLits #endif #ifdef __HUGS__ import Hugs.IOExts -#else -import Unsafe.Coerce #endif -import Foreign.Ptr -import Foreign.StablePtr +#ifdef MIN_VERSION_template_haskell +import Language.Haskell.TH hiding (reify) +#endif + import System.IO.Unsafe -import Data.Bits -import Data.Word -import Data.Typeable -#if !MIN_VERSION_base(4,8,0) -import Control.Applicative +#ifndef __HUGS__ +import Unsafe.Coerce #endif #ifdef HLINT @@ -512,3 +540,82 @@ reifyByte (fromIntegral (n `shiftR` 56)) (\s7 -> reflectBefore (fmap return k) $ stable s0 s1 s2 s3 s4 s5 s6 s7)))))))) + + +data ReifiedMonoid a = ReifiedMonoid { reifiedMappend :: a -> a -> a, reifiedMempty :: a } + +instance Reifies s (ReifiedMonoid a) => Monoid (ReflectedMonoid a s) where + mappend (ReflectedMonoid x) (ReflectedMonoid y) = reflectResult (\m -> ReflectedMonoid (reifiedMappend m x y)) + mempty = reflectResult (\m -> ReflectedMonoid (reifiedMempty m )) + +reflectResult :: forall f s a. Reifies s a => (a -> f s) -> f s +reflectResult f = f (reflect (Proxy :: Proxy s)) + +newtype ReflectedMonoid a s = ReflectedMonoid a + +unreflectedMonoid :: ReflectedMonoid a s -> proxy s -> a +unreflectedMonoid (ReflectedMonoid a) _ = a + +reifyMonoid :: (a -> a -> a) -> a -> (forall (s :: *). Reifies s (ReifiedMonoid a) => t -> ReflectedMonoid a s) -> t -> a +reifyMonoid f z m xs = reify (ReifiedMonoid f z) (unreflectedMonoid (m xs)) + +-- | Fold a value using its 'Foldable' instance using +-- explicitly provided 'Monoid' operations. This is like 'fold' +-- where the 'Monoid' instance can be manually specified. +-- +-- @ +-- 'foldBy' 'mappend' 'mempty' ≡ 'fold' +-- @ +-- +-- >>> foldBy (++) [] ["hello","world"] +-- "helloworld" +foldBy :: Foldable t => (a -> a -> a) -> a -> t a -> a +foldBy f z = reifyMonoid f z (foldMap ReflectedMonoid) + +-- | Fold a value using its 'Foldable' instance using +-- explicitly provided 'Monoid' operations. This is like 'foldMap' +-- where the 'Monoid' instance can be manually specified. +-- +-- @ +-- 'foldMapBy' 'mappend' 'mempty' ≡ 'foldMap' +-- @ +-- +-- >>> foldMapBy (+) 0 length ["hello","world"] +-- 10 +foldMapBy :: Foldable t => (r -> r -> r) -> r -> (a -> r) -> t a -> r +foldMapBy f z g = reifyMonoid f z (foldMap (ReflectedMonoid #. g)) + +data ReifiedApplicative f = ReifiedApplicative { reifiedPure :: forall a. a -> f a, reifiedAp :: forall a b. f (a -> b) -> f a -> f b } + +newtype ReflectedApplicative f s a = ReflectedApplicative (f a) + +instance Reifies s (ReifiedApplicative f) => Functor (ReflectedApplicative f s) where + fmap = liftA + +instance Reifies s (ReifiedApplicative f) => Applicative (ReflectedApplicative f s) where + pure a = reflectResult1 (\m -> ReflectedApplicative (reifiedPure m a)) + ReflectedApplicative x <*> ReflectedApplicative y = reflectResult1 (\m -> ReflectedApplicative (reifiedAp m x y)) + +reflectResult1 :: forall f s a b. Reifies s a => (a -> f s b) -> f s b +reflectResult1 f = f (reflect (Proxy :: Proxy s)) + +unreflectedApplicative :: ReflectedApplicative f s a -> proxy s -> f a +unreflectedApplicative (ReflectedApplicative a) _ = a + +reifyApplicative :: (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (forall (s :: *). Reifies s (ReifiedApplicative f) => t -> ReflectedApplicative f s a) -> t -> f a +reifyApplicative f g m xs = reify (ReifiedApplicative f g) (unreflectedApplicative (m xs)) + +-- | Traverse a container using its 'Traversable' instance using +-- explicitly provided 'Applicative' operations. This is like 'traverse' +-- where the 'Applicative' instance can be manually specified. +traverseBy :: Traversable t => (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> (a -> f b) -> t a -> f (t b) +traverseBy pur app f = reifyApplicative pur app (traverse (ReflectedApplicative #. f)) + +-- | Sequence a container using its 'Traversable' instance using +-- explicitly provided 'Applicative' operations. This is like 'sequence' +-- where the 'Applicative' instance can be manually specified. +sequenceBy :: Traversable t => (forall x. x -> f x) -> (forall x y. f (x -> y) -> f x -> f y) -> t (f a) -> f (t a) +sequenceBy pur app = reifyApplicative pur app (traverse ReflectedApplicative) + +(#.) :: (b -> c) -> (a -> b) -> a -> c +(#.) _ = unsafeCoerce diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/reflection-2/reflection.cabal new/reflection-2.1/reflection.cabal --- old/reflection-2/reflection.cabal 2015-07-10 00:11:14.000000000 +0200 +++ new/reflection-2.1/reflection.cabal 2015-09-14 01:22:48.000000000 +0200 @@ -1,5 +1,5 @@ name: reflection -version: 2 +version: 2.1 license: BSD3 license-file: LICENSE author: Edward A. Kmett, Elliott Hird, Oleg Kiselyov and Chung-chieh Shan
