lens-action 0.1.0.1 → 0.2
raw patch · 4 files changed
+10/−95 lines, 4 filesdep ~basedep ~profunctorsdep ~semigroupoids
Dependency ranges changed: base, profunctors, semigroupoids
Files
- CHANGELOG.markdown +0/−4
- lens-action.cabal +3/−4
- src/Control/Lens/Action.hs +7/−0
- src/Control/Lens/Action/Type.hs +0/−87
CHANGELOG.markdown view
@@ -1,7 +1,3 @@-0.1.0.1-----* Add `Control.Lens.Action.Type` to exposed-modules list.- 0.1 ---- * Initial split from lens package
lens-action.cabal view
@@ -1,6 +1,6 @@ name: lens-action category: Data, Lenses, Generics-version: 0.1.0.1+version: 0.2 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -39,17 +39,16 @@ base >= 4.5 && < 5, comonad >= 4 && < 5, contravariant >= 0.3 && < 2,- profunctors >= 4 && < 5,+ profunctors >= 4 && < 6, mtl >= 2.0.1 && < 2.3, semigroups >= 0.8.4 && < 1,- semigroupoids >= 4 && < 5,+ semigroupoids >= 4 && < 6, transformers >= 0.2 && < 0.5 exposed-modules: Control.Lens.Action Control.Lens.Action.Internal Control.Lens.Action.Reified- Control.Lens.Action.Type cpp-options: -traditional
src/Control/Lens/Action.hs view
@@ -55,6 +55,9 @@ import Control.Monad.Trans.Class import Data.Profunctor import Data.Profunctor.Rep+#if MIN_VERSION_profunctors(5,0,0)+import Data.Profunctor.Sieve+#endif import Data.Profunctor.Unsafe import Control.Lens.Action.Internal@@ -135,7 +138,11 @@ act :: Monad m => (s -> m a) -> IndexPreservingAction m s a act sma pafb = cotabulate $ \ws -> effective $ do a <- sma (extract ws)+#if MIN_VERSION_profunctors(5,0,0)+ ineffective (cosieve pafb (a <$ ws))+#else ineffective (corep pafb (a <$ ws))+#endif {-# INLINE act #-} -- | A self-running 'Action', analogous to 'Control.Monad.join'.
− src/Control/Lens/Action/Type.hs
@@ -1,87 +0,0 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE Rank2Types #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE MultiParamTypeClasses #-}-#ifdef TRUSTWORTHY-{-# LANGUAGE Trustworthy #-}-#endif--------------------------------------------------------------------------------- |--- Module : Control.Lens.Action.Type--- Copyright : (C) 2012-14 Edward Kmett--- License : BSD-style (see the file LICENSE)--- Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : experimental--- Portability : non-portable---------------------------------------------------------------------------------module Control.Lens.Action.Type- ( -- * Getters and Folds- Action- , MonadicFold- , RelevantMonadicFold- -- * Indexed- , IndexedAction- , IndexedMonadicFold- , IndexedRelevantMonadicFold- -- * Index-Preserving- , IndexPreservingAction- , IndexPreservingMonadicFold- , IndexPreservingRelevantMonadicFold- ) where--import Control.Applicative (Applicative)-import Control.Lens (Conjoined, Indexable)-import Data.Functor.Apply (Apply)-import Prelude ()--import Control.Lens.Action.Internal (Effective)------------------------------------------------------------------------------------ Actions------------------------------------------------------------------------------------ | An 'Action' is a 'Getter' enriched with access to a 'Monad' for side-effects.------ Every 'Getter' can be used as an 'Action'.------ You can compose an 'Action' with another 'Action' using ('Prelude..') from the @Prelude@.-type Action m s a = forall f r. Effective m r f => (a -> f a) -> s -> f s---- | An 'IndexedAction' is an 'IndexedGetter' enriched with access to a 'Monad' for side-effects.------ Every 'Getter' can be used as an 'Action'.------ You can compose an 'Action' with another 'Action' using ('Prelude..') from the @Prelude@.-type IndexedAction i m s a = forall p f r. (Indexable i p, Effective m r f) => p a (f a) -> s -> f s---- | An 'IndexPreservingAction' can be used as a 'Action', but when composed with an 'IndexedTraversal',--- 'IndexedFold', or 'IndexedLens' yields an 'IndexedMonadicFold', 'IndexedMonadicFold' or 'IndexedAction' respectively.-type IndexPreservingAction m s a = forall p f r. (Conjoined p, Effective m r f) => p a (f a) -> p s (f s)------------------------------------------------------------------------------------ MonadicFolds------------------------------------------------------------------------------------ | A 'MonadicFold' is a 'Fold' enriched with access to a 'Monad' for side-effects.------ A 'MonadicFold' can use side-effects to produce parts of the structure being folded (e.g. reading them from file).------ Every 'Fold' can be used as a 'MonadicFold', that simply ignores the access to the 'Monad'.------ You can compose a 'MonadicFold' with another 'MonadicFold' using ('Prelude..') from the @Prelude@.-type MonadicFold m s a = forall f r. (Effective m r f, Applicative f) => (a -> f a) -> s -> f s-type RelevantMonadicFold m s a = forall f r. (Effective m r f, Apply f) => (a -> f a) -> s -> f s---- | An 'IndexedMonadicFold' is an 'IndexedFold' enriched with access to a 'Monad' for side-effects.------ Every 'IndexedFold' can be used as an 'IndexedMonadicFold', that simply ignores the access to the 'Monad'.------ You can compose an 'IndexedMonadicFold' with another 'IndexedMonadicFold' using ('Prelude..') from the @Prelude@.-type IndexedMonadicFold i m s a = forall p f r. (Indexable i p, Effective m r f, Applicative f) => p a (f a) -> s -> f s-type IndexedRelevantMonadicFold i m s a = forall p f r. (Indexable i p, Effective m r f, Apply f) => p a (f a) -> s -> f s---- | An 'IndexPreservingFold' can be used as a 'Fold', but when composed with an 'IndexedTraversal',--- 'IndexedFold', or 'IndexedLens' yields an 'IndexedFold' respectively.-type IndexPreservingMonadicFold m s a = forall p f r. (Conjoined p, Effective m r f, Applicative f) => p a (f a) -> p s (f s)-type IndexPreservingRelevantMonadicFold m s a = forall p f r. (Conjoined p, Effective m r f, Apply f) => p a (f a) -> p s (f s)