Safe Haskell | None |
---|---|
Language | Haskell2010 |
A lens library that integrates with OverloadedLabels.
Unlike the lens
package (and others), lenses are defined as a newtype
instead of a type synonym, to avoid overlapping with other IsLabel
instances. However, the LensFn
and runLens
functions allow converting
between the two types; for example:
LensFn :: Control.Lens.LensLike f s t a b -> Lens.Labels.LensLike f s t a b runLens :: Lens.Labels.LensLike f s t a b -> Control.Lens.LensLike f s t a b
TODO: support more general optic types (e.g., prisms).
Synopsis
- newtype LensFn a b = LensFn {
- runLens :: a -> b
- type LensLike f s t a b = LensFn (a -> f b) (s -> f t)
- type LensLike' f s a = LensLike f s s a a
- (&) :: a -> (a -> b) -> b
- (.) :: Category cat => cat b c -> cat a b -> cat a c
- type Lens s t a b = forall f. Functor f => LensLike f s t a b
- type Lens' s a = Lens s s a a
- data Proxy# :: forall k0. k0 -> TYPE (TupleRep ([] :: [RuntimeRep]))
- proxy# :: Proxy# a
- class HasLens' s (x :: Symbol) a | s x -> a where
- type ASetter s t a b = LensLike Identity s t a b
- (.~) :: ASetter s t a b -> b -> s -> t
- (%~) :: ASetter s t a b -> (a -> b) -> s -> t
- set :: ASetter s t a b -> b -> s -> t
- over :: ASetter s t a b -> (a -> b) -> s -> t
- newtype Const a (b :: k) :: forall k. * -> k -> * = Const {
- getConst :: a
- type Getting r s t a b = LensLike (Const r) s t a b
- (^.) :: s -> Getting a s t a b -> a
- view :: Getting a s t a b -> s -> a
Lenses
A newtype for defining lenses. Can be composed using '(Control.Category..)', which is exported from this module.
HasLens
data Proxy# :: forall k0. k0 -> TYPE (TupleRep ([] :: [RuntimeRep])) #
The type constructor Proxy#
is used to bear witness to some
type variable. It's used when you want to pass around proxy values
for doing things like modelling type applications. A Proxy#
is not only unboxed, it also has a polymorphic kind, and has no
runtime representation, being totally free.
Setters
Getters
newtype Const a (b :: k) :: forall k. * -> k -> * #
The Const
functor.
Instances
Generic1 (Const a :: k -> *) | |
Functor (Const m :: * -> *) | Since: base-2.1 |
Monoid m => Applicative (Const m :: * -> *) | Since: base-2.0.1 |
Foldable (Const m :: * -> *) | Since: base-4.7.0.0 |
Defined in Data.Functor.Const fold :: Monoid m0 => Const m m0 -> m0 # foldMap :: Monoid m0 => (a -> m0) -> Const m a -> m0 # foldr :: (a -> b -> b) -> b -> Const m a -> b # foldr' :: (a -> b -> b) -> b -> Const m a -> b # foldl :: (b -> a -> b) -> b -> Const m a -> b # foldl' :: (b -> a -> b) -> b -> Const m a -> b # foldr1 :: (a -> a -> a) -> Const m a -> a # foldl1 :: (a -> a -> a) -> Const m a -> a # elem :: Eq a => a -> Const m a -> Bool # maximum :: Ord a => Const m a -> a # minimum :: Ord a => Const m a -> a # | |
Traversable (Const m :: * -> *) | Since: base-4.7.0.0 |
Bounded a => Bounded (Const a b) | |
Enum a => Enum (Const a b) | |
Defined in Data.Functor.Const succ :: Const a b -> Const a b # pred :: Const a b -> Const a b # fromEnum :: Const a b -> Int # enumFrom :: Const a b -> [Const a b] # enumFromThen :: Const a b -> Const a b -> [Const a b] # enumFromTo :: Const a b -> Const a b -> [Const a b] # enumFromThenTo :: Const a b -> Const a b -> Const a b -> [Const a b] # | |
Eq a => Eq (Const a b) | |
Floating a => Floating (Const a b) | |
Defined in Data.Functor.Const exp :: Const a b -> Const a b # log :: Const a b -> Const a b # sqrt :: Const a b -> Const a b # (**) :: Const a b -> Const a b -> Const a b # logBase :: Const a b -> Const a b -> Const a b # sin :: Const a b -> Const a b # cos :: Const a b -> Const a b # tan :: Const a b -> Const a b # asin :: Const a b -> Const a b # acos :: Const a b -> Const a b # atan :: Const a b -> Const a b # sinh :: Const a b -> Const a b # cosh :: Const a b -> Const a b # tanh :: Const a b -> Const a b # asinh :: Const a b -> Const a b # acosh :: Const a b -> Const a b # atanh :: Const a b -> Const a b # log1p :: Const a b -> Const a b # expm1 :: Const a b -> Const a b # | |
Fractional a => Fractional (Const a b) | |
Integral a => Integral (Const a b) | |
Defined in Data.Functor.Const | |
Num a => Num (Const a b) | |
Ord a => Ord (Const a b) | |
Defined in Data.Functor.Const | |
Read a => Read (Const a b) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 |
Real a => Real (Const a b) | |
Defined in Data.Functor.Const toRational :: Const a b -> Rational # | |
RealFloat a => RealFloat (Const a b) | |
Defined in Data.Functor.Const floatRadix :: Const a b -> Integer # floatDigits :: Const a b -> Int # floatRange :: Const a b -> (Int, Int) # decodeFloat :: Const a b -> (Integer, Int) # encodeFloat :: Integer -> Int -> Const a b # exponent :: Const a b -> Int # significand :: Const a b -> Const a b # scaleFloat :: Int -> Const a b -> Const a b # isInfinite :: Const a b -> Bool # isDenormalized :: Const a b -> Bool # isNegativeZero :: Const a b -> Bool # | |
RealFrac a => RealFrac (Const a b) | |
Show a => Show (Const a b) | This instance would be equivalent to the derived instances of the
Since: base-4.8.0.0 |
Ix a => Ix (Const a b) | |
Defined in Data.Functor.Const range :: (Const a b, Const a b) -> [Const a b] # index :: (Const a b, Const a b) -> Const a b -> Int # unsafeIndex :: (Const a b, Const a b) -> Const a b -> Int inRange :: (Const a b, Const a b) -> Const a b -> Bool # rangeSize :: (Const a b, Const a b) -> Int # unsafeRangeSize :: (Const a b, Const a b) -> Int | |
Generic (Const a b) | |
Semigroup a => Semigroup (Const a b) | |
Monoid a => Monoid (Const a b) | |
Storable a => Storable (Const a b) | |
Defined in Data.Functor.Const | |
Bits a => Bits (Const a b) | |
Defined in Data.Functor.Const (.&.) :: Const a b -> Const a b -> Const a b # (.|.) :: Const a b -> Const a b -> Const a b # xor :: Const a b -> Const a b -> Const a b # complement :: Const a b -> Const a b # shift :: Const a b -> Int -> Const a b # rotate :: Const a b -> Int -> Const a b # setBit :: Const a b -> Int -> Const a b # clearBit :: Const a b -> Int -> Const a b # complementBit :: Const a b -> Int -> Const a b # testBit :: Const a b -> Int -> Bool # bitSizeMaybe :: Const a b -> Maybe Int # isSigned :: Const a b -> Bool # shiftL :: Const a b -> Int -> Const a b # unsafeShiftL :: Const a b -> Int -> Const a b # shiftR :: Const a b -> Int -> Const a b # unsafeShiftR :: Const a b -> Int -> Const a b # rotateL :: Const a b -> Int -> Const a b # | |
FiniteBits a => FiniteBits (Const a b) | |
Defined in Data.Functor.Const finiteBitSize :: Const a b -> Int # countLeadingZeros :: Const a b -> Int # countTrailingZeros :: Const a b -> Int # | |
type Rep1 (Const a :: k -> *) | |
Defined in Data.Functor.Const | |
type Rep (Const a b) | |
Defined in Data.Functor.Const |