Copyright | (C) 2013-2016 Edward Kmett 2018 Monadfix |
---|---|
License | BSD-style (see the file LICENSE) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Definitions used internally by microlens. If you're going to use these, only define instances for your own types, and don't export an API using these!
Synopsis
- class Strict lazy strict | lazy -> strict, strict -> lazy where
- class IsText t where
- data Exchange a b s t = Exchange (s -> a) (b -> t)
- type Exchange' a s = Exchange a a s s
- data Market a b s t = Market (b -> t) (s -> Either t a)
- type Market' a s = Market a a s s
- type Iso s t a b = forall p f. (Profunctor p, Functor f) => p a (f b) -> p s (f t)
- type Iso' s a = Iso s s a a
- type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t)
- type Prism' s a = Prism s s a a
Documentation
data Exchange a b s t Source #
This type is used internally to provide efficient access
to the two inverse functions behind an Iso
.
Exchange (s -> a) (b -> t) |
Instances
Profunctor (Exchange a b) Source # | |
Defined in Lens.Micro.Pro.Internal dimap :: (a0 -> b0) -> (c -> d) -> Exchange a b b0 c -> Exchange a b a0 d # lmap :: (a0 -> b0) -> Exchange a b b0 c -> Exchange a b a0 c # rmap :: (b0 -> c) -> Exchange a b a0 b0 -> Exchange a b a0 c # (#.) :: forall a0 b0 c q. Coercible c b0 => q b0 c -> Exchange a b a0 b0 -> Exchange a b a0 c # (.#) :: forall a0 b0 c q. Coercible b0 a0 => Exchange a b b0 c -> q a0 b0 -> Exchange a b a0 c # | |
Functor (Exchange a b s) Source # | |
This type is used internally by the Prism code to provide efficient access
to the two parts of a Prism, i.e. a constructor and a selector — see:
prism
.
Instances
Choice (Market a b) Source # | |
Profunctor (Market a b) Source # | |
Defined in Lens.Micro.Pro.Internal dimap :: (a0 -> b0) -> (c -> d) -> Market a b b0 c -> Market a b a0 d # lmap :: (a0 -> b0) -> Market a b b0 c -> Market a b a0 c # rmap :: (b0 -> c) -> Market a b a0 b0 -> Market a b a0 c # (#.) :: forall a0 b0 c q. Coercible c b0 => q b0 c -> Market a b a0 b0 -> Market a b a0 c # (.#) :: forall a0 b0 c q. Coercible b0 a0 => Market a b b0 c -> q a0 b0 -> Market a b a0 c # | |
Functor (Market a b s) Source # | |
type Iso s t a b = forall p f. (Profunctor p, Functor f) => p a (f b) -> p s (f t) Source #
The type signature of iso
provides a nice interpretation of
Iso
. If you want to apply a function a -> b
to a type s
, you'd have to
convert with s -> a
, apply your function a -> b
, and convert back with
b -> t
.
iso
:: (s -> a) -> (b -> t) -> Iso s t a b -- or, put monomorphicallyiso
:: (s -> a) -> (a -> s) -> Iso' s a
type Iso' s a = Iso s s a a Source #
The type of monomorphic isomorphisms, i.e. isos that change neither the outer type
s
nor the inner type a
.
type Prism s t a b = forall p f. (Choice p, Applicative f) => p a (f b) -> p s (f t) Source #
s
is the type of the whole structuret
is the type of the reconstructed structurea
is the type of the targetb
is the type of the value used for reconstruction