applicative-extras 0.1.4 → 0.1.5
raw patch · 2 files changed
+36/−5 lines, 2 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Control.Applicative.Backwards: Backwards :: t a -> Backwards t a
+ Control.Applicative.Backwards: forwards :: Backwards t a -> t a
+ Control.Applicative.Backwards: instance (Applicative t) => Applicative (Backwards t)
+ Control.Applicative.Backwards: instance (Foldable t) => Foldable (Backwards t)
+ Control.Applicative.Backwards: instance (Functor t) => Functor (Backwards t)
+ Control.Applicative.Backwards: instance (Traversable t) => Traversable (Backwards t)
+ Control.Applicative.Backwards: newtype Backwards t a
Files
+ Control/Applicative/Backwards.hs view
@@ -0,0 +1,29 @@+module Control.Applicative.Backwards where++import Prelude hiding (foldr, foldr1, foldl, foldl1)+import Control.Applicative+import Data.Foldable+import Data.Traversable+import Data.Monoid++newtype Backwards t a = Backwards { forwards :: t a }++instance (Functor t) => Functor (Backwards t) where+ fmap f (Backwards a) = Backwards (fmap f a)++instance (Applicative t) => Applicative (Backwards t) where+ pure a = Backwards (pure a)+ (Backwards f) <*> (Backwards a) = Backwards (a <**> f)++instance (Foldable t) => Foldable (Backwards t) where+ foldMap f (Backwards t) = getDual (foldMap (Dual . f) t)+ foldr f z (Backwards t) = foldl (flip f) z t+ foldl f z (Backwards t) = foldr (flip f) z t+ foldr1 f (Backwards t) = foldl1 (flip f) t+ foldl1 f (Backwards t) = foldr1 (flip f) t++instance (Traversable t) => Traversable (Backwards t) where+ traverse f (Backwards t) =+ fmap Backwards . forwards $ traverse (Backwards . f) t+ sequenceA (Backwards t) =+ fmap Backwards . forwards $ sequenceA (fmap Backwards t)
applicative-extras.cabal view
@@ -1,15 +1,17 @@ Name: applicative-extras-Version: 0.1.4+Version: 0.1.5 Synopsis: Instances for Applicative-Description: Some instances for Applicative and type-level composition.+Description: Some instances for applicative functors and type-level+ composition. Forkable on github. Category: Control+Homepage: http://github.com/chriseidhof/applicative-extras/ License: BSD3 License-file: LICENSE-Copyright: (c) Tupil-Author: Chris Eidhof <ce+hackage@tupil.com>+Author: Chris Eidhof <ce+hackage@tupil.com>, Russel O'Connor Maintainer: Chris Eidhof <ce+hackage@tupil.com> Exposed-Modules: Control.Applicative.Compose , Control.Applicative.Error , Control.Applicative.State+ , Control.Applicative.Backwards Build-Type: Simple-Build-Depends: base, haskell98, mtl+Build-Depends: base >= 3 && < 5, haskell98, mtl