module Lens.Family.Unchecked (
lens
, iso
, setting
, LensLike, LensLike'
, Identical
) where
import Control.Applicative (pure)
import Lens.Family.Identical (Identical, extract)
type LensLike f a a' b b' = (b -> f b') -> (a -> f a')
type LensLike' f a b = (b -> f b) -> (a -> f a)
lens :: Functor f
=> (a -> b)
-> (a -> b' -> a')
-> LensLike f a a' b b'
lens getter setter f a = fmap (setter a) (f (getter a))
iso :: Functor f
=> (a -> b)
-> (b' -> a')
-> LensLike f a a' b b'
iso getter setter = lens getter (const setter)
setting :: Identical f
=> ((b -> b') -> a -> a')
-> LensLike f a a' b b'
setting s f = pure . s (extract . f)