Skip to content
Paolo G. Giarrusso edited this page Jul 13, 2014 · 8 revisions

Types

Type Equivalent to Notes
type Lens s t a b = ∀f. Functor f => (a -> f b) -> s -> f t s -> (a, b -> t)  
type Traversal s t a b = ∀f. Applicative f => (a -> f b) -> s -> f t s -> ∃n. (a^n, b^n -> t) X
type Getter s a = ∀f. Gettable f => (a -> f a) -> s -> f s s -> a  
type Setter s t a b = ∀f. Settable f => (a -> f b) -> s -> f t (a -> b) -> s -> t  
type Fold s a = ∀f. (Gettable f, Applicative f) => (a -> f a) -> s -> f s s -> [a]  
type Iso s t a b = ∀f k. (Isomorphic k, Functor f) => k (a -> f b) (s -> f t) (s -> a, b -> t)  
Indexed
type IndexedLens i s t a b = ∀f k. (Indexed i k, Functor f) => k (a -> f b) (s -> f t) s -> ((i, a), b -> t)  
type IndexedTraversal i s t a b = ∀f k. (Indexed i k, Applicative f) => k (a -> f b) (s -> f t) s -> ∃n. ((i, a)^n, b^n -> t) X
type IndexedGetter i s a = ∀f k. (Indexed i k, Gettable f) => k (a -> f a) (s -> f s) s -> (i, a)  
type IndexedSetter i s t a b = ∀f k. (Indexed i k, Settable f) => k (a -> f b) (s -> f t) ((i, a) -> b) -> s -> t  
type IndexedFold i s a = ∀f. (Indexed i k, Gettable f, Applicative f) => k (a -> f a) (s -> f s) s -> [(i, a)]  
Monadic
type Action m s a = ∀f. Effective m r f => (a -> f a) -> s-> f s s -> m a  
type MonadicFold m s a = ∀f. (Effective m r f, Applicative f) => (a -> f a) -> s -> f s s -> m [a]  
Hypothetical
type PartialLens s t a b = ∀f. Pointed f => (a -> f b) -> s -> f t s -> Either t (a, b -> t)  
type NonEmptyTraversal s t a b = ∀f. Apply f => (a -> f b) -> s -> f t s -> ∃n. (a^(n+1), b^(n+1) -> t) X
  • a^n means "a list of n values of type a".
Clone this wiki locally