microlens-pro-0.1.0: Prisms and isomorphisms for microlens
Copyright(C) 2013-2016 Edward Kmett 2018 Monadfix
LicenseBSD-style (see the file LICENSE)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Lens.Micro.Pro.Type

Description

This module defines just the Iso and Prism types, in order to break a dependency cycle. You'll find the interesting stuff in Pro and Internal.

Synopsis

Documentation

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 monomorphically
iso :: (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 structure
  • t is the type of the reconstructed structure
  • a is the type of the target
  • b is the type of the value used for reconstruction

type Prism' s a = Prism s s a a Source #

The type of monomorphic prisms, i.e. prisms that change neither the outer type s nor the inner type a.