Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

- to :: (Profunctor p, Functor f, Contravariant f) => (s -> a) -> Optic' p f s a
- module Control.Lens

# Documentation

to :: (Profunctor p, Functor f, Contravariant f) => (s -> a) -> Optic' p f s a Source #

Build an (index-preserving) `Getter`

from an arbitrary Haskell function.
See Control.Lens.`to`

for details.

In lens-4.14, the constraint

is missing from the definition of `Functor`

f`to`

. When compiling
with GHC 8.0, this leads to warnings for definitions like

foo :: Getter Bar Foo foo = to fooFromBar

because of the redundant

constraint. This definition is
identical to Control.Lens.`Functor`

f`to`

except for the additional constraint

.`Functor`

f

module Control.Lens