module Lens.Simple (
view
, set
, over
, _1
, _2
, _Left, _Right
, _Just, _Nothing
, both
, Lens
, Traversal
, Setter
, Getter
, Fold
, FoldLike
, SetterLike
, LensLike
, lens
, iso
, to
, setting
, folding
, (^.)
, (%~)
, (.~)
, (&)
, (??)
, (?~)
, (^..)
, (^?)
, zoom
, zoom_
, use, uses
, assign
, (%=)
, (.=)
, (%%=)
, (<~)
, (+~), (*~), (-~), (//~), (&&~), (||~), (<>~)
, (+=), (-=), (*=), (//=), (&&=), (||=), (<>=)
, chosen
, ix
, at, intAt
, contains, intContains
, ignored
, mapped
, views
, toListOf, allOf, anyOf, firstOf, lastOf, sumOf, productOf
, lengthOf, nullOf
, backwards
, choosing
, alongside
, beside
, makeLenses
, makeTraversals
, makeLensesBy
, makeLensesFor
, LensLike'
, Lens'
, Traversal'
, Getter'
, Setter'
, FoldLike'
, Identical(..)
, Phantom(..)
, AlongsideLeft, AlongsideRight
, Zooming
, Constant (..), Identity (..)
, Monoid(..),(<>)
) where
import Lens.Family2.Unchecked
import Lens.Family2.Stock
import Lens.Family2.State.Strict
import Lens.Family2.TH (makeLenses, makeTraversals, makeLensesBy, makeLensesFor)
import Data.Monoid
import Data.Functor.Identity
import Data.Functor.Constant
import Control.Monad.Trans.State.Strict (StateT(..))
import Control.Monad.State.Strict
#if MIN_VERSION_base(4,8,0)
import Data.Function ((&))
import Lens.Family2 hiding ((&))
#else
import Lens.Family2
#endif
infixl 1 ??
(??) :: Functor f => f (a -> b) -> a -> f b
ff ?? a = fmap ($ a) ff
type SetterLike a a' b b' = LensLike Identity a a' b b'
(?~) :: Setter a a' b (Maybe b') -> b' -> a -> a'
l ?~ b = set l (Just b)
zoom_
:: MonadState s' m =>
LensLike' (Zooming m a) s' s -> StateT s m a -> m a
zoom_ l f = abstract $ zoom l f where
abstract st = do
s <- get
(a,s') <- runStateT st s
put s'
return a