packages feed

contravariant 0.5.2 → 0.6

raw patch · 4 files changed

+57/−25 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Functor.Contravariant: instance [safe] (Contravariant f, Contravariant g) => Contravariant (Sum f g)

Files

Data/Functor/Contravariant.hs view
@@ -1,17 +1,21 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE TypeOperators #-}++#ifdef __GLASGOW_HASKELL__+#define LANGUAGE_DeriveDataTypeable {-# LANGUAGE DeriveDataTypeable #-}-#if __GLASGOW_HASKELL__ >= 702-#if MIN_VERSION_transformers(0,3,0)-#if MIN_VERSION_tagged(0,6,1)-{-# LANGUAGE Safe #-}-#else-{-# LANGUAGE Trustworthy #-} #endif++#ifndef MIN_VERSION_tagged+#define MIN_VERSION_tagged(x,y,z) 1+#endif++#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 && MIN_VERSION_transformers(0,3,0) && MIN_VERSION_tagged(0,6,1)+{-# LANGUAGE Safe #-} #else {-# LANGUAGE Trustworthy #-} #endif-#endif+ ----------------------------------------------------------------------------- -- | -- Module      :  Data.Functor.Contravariant@@ -51,18 +55,30 @@  import Control.Applicative import Control.Applicative.Backwards+ import Control.Category+ import Data.Functor.Product+import Data.Functor.Sum import Data.Functor.Constant import Data.Functor.Compose import Data.Functor.Reverse-import GHC.Generics-import Prelude hiding ((.),id)++#ifdef LANGUAGE_DeriveDataTypeable import Data.Typeable-#if __GLASGOW_HASKELL__ < 707+#endif++#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 707 && defined(VERSION_tagged) import Data.Proxy #endif +#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702+#define GHC_GENERICS+import GHC.Generics+#endif++import Prelude hiding ((.),id)+ -- | Any instance should be subject to the following laws: -- -- > contramap id = id@@ -91,6 +107,7 @@ (>$$<) = flip contramap {-# INLINE (>$$<) #-} +#ifdef GHC_GENERICS instance Contravariant V1 where   contramap _ x = x `seq` undefined @@ -116,7 +133,12 @@ instance (Contravariant f, Contravariant g) => Contravariant (f :+: g) where   contramap f (L1 xs) = L1 (contramap f xs)   contramap f (R1 ys) = R1 (contramap f ys)+#endif +instance (Contravariant f, Contravariant g) => Contravariant (Sum f g) where+  contramap f (InL xs) = InL (contramap f xs)+  contramap f (InR ys) = InR (contramap f ys)+ instance (Contravariant f, Contravariant g) => Contravariant (Product f g) where   contramap f (Pair a b) = Pair (contramap f a) (contramap f b) @@ -138,16 +160,16 @@   contramap f = Reverse . contramap f . getReverse   {-# INLINE contramap #-} +#if (defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 707) || defined(VERSION_tagged) instance Contravariant Proxy where   contramap _ Proxy = Proxy+#endif  newtype Predicate a = Predicate { getPredicate :: a -> Bool }-#ifdef __GLASGOW_HASKELL__+#ifdef LANGUAGE_DeriveDataTypeable   deriving Typeable #endif -- -- | A 'Predicate' is a 'Contravariant' 'Functor', because 'contramap' can -- apply its function argument to the input of the predicate. instance Contravariant Predicate where@@ -155,7 +177,7 @@  -- | Defines a total ordering on a type as per 'compare' newtype Comparison a = Comparison { getComparison :: a -> a -> Ordering }-#ifdef __GLASGOW_HASKELL__+#ifdef LANGUAGE_DeriveDataTypeable   deriving Typeable #endif @@ -171,7 +193,7 @@  -- | Define an equivalence relation newtype Equivalence a = Equivalence { getEquivalence :: a -> a -> Bool }-#ifdef __GLASGOW_HASKELL__+#ifdef LANGUAGE_DeriveDataTypeable   deriving Typeable #endif @@ -187,7 +209,7 @@  -- | Dual function arrows. newtype Op a b = Op { getOp :: b -> a }-#ifdef __GLASGOW_HASKELL__+#ifdef LANGUAGE_DeriveDataTypeable   deriving Typeable #endif @@ -197,4 +219,3 @@  instance Contravariant (Op a) where   contramap f g = Op (getOp g . f)-
Data/Functor/Contravariant/Day.hs view
@@ -12,7 +12,7 @@ #endif ----------------------------------------------------------------------------- -- |--- Copyright   :  (C) 2013 Edward Kmett, Gershom Bazerman and Derek Elkins+-- Copyright   :  (C) 2013-2014 Edward Kmett, Gershom Bazerman and Derek Elkins -- License     :  BSD-style (see the file LICENSE) -- -- Maintainer  :  Edward Kmett <ekmett@gmail.com>
LICENSE view
@@ -1,4 +1,4 @@-Copyright 2007-2011 Edward Kmett+Copyright 2007-2014 Edward Kmett  All rights reserved. 
contravariant.cabal view
@@ -1,6 +1,6 @@ name:          contravariant category:      Control, Data-version:       0.5.2+version:       0.6 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE@@ -9,7 +9,7 @@ stability:     provisional homepage:      http://github.com/ekmett/contravariant/ bug-reports:   http://github.com/ekmett/contravariant/issues-copyright:     Copyright (C) 2007-2013 Edward A. Kmett+copyright:     Copyright (C) 2007-2014 Edward A. Kmett synopsis:      Contravariant functors description:   Contravariant functors build-type:    Simple@@ -21,13 +21,23 @@   type: git   location: git://github.com/ekmett/contravariant.git +flag tagged+  description:+    You can disable the use of the `tagged` package on older versons of GHC using `-f-tagged`.+    .+    Disabling this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users.+  default: True+  manual: True+ library   build-depends:-    base                            < 5,-    tagged              >= 0.4.4 && < 1,-    transformers        >= 0.2   && < 0.5,-    transformers-compat >= 0.3   && < 1+    base < 5,+    transformers >= 0.2 && < 0.5,+    transformers-compat >= 0.3 && < 1 +  if flag(tagged) && !impl(ghc >= 7.7)+    build-depends: tagged >= 0.4.4 && < 1+   if impl(ghc >= 7.4 && < 7.6)     build-depends: ghc-prim @@ -35,4 +45,5 @@     Data.Functor.Contravariant     Data.Functor.Contravariant.Compose     Data.Functor.Contravariant.Day+   ghc-options: -Wall