LicenseGNU LGPLv3
Maintainerpaul.bittner@uni-ulm.de
Safe HaskellSafe

Defunctor

Description

Module for type class Defunctor and some instances for Prelude types. Defunctors can de-lift functions from embellished types to plain types.

Synopsis

Documentation

class Defunctor f where Source #

A Defunctor is a type that allows de-lifting functions from embellished types to functions on the types that are embellished. This can be seen sort of an inverse of a functor that is not always possible to construct.

Methods

demap :: (f a -> f b) -> a -> b Source #

Inverse of fmap. Takes a function on embellished values (e.g., a functor or monad) and turns it into a plain function on values. This inversion is usually impossible or only a partial function.

Instances

Instances details
Defunctor [] Source #

Lists are Defunctors.

Instance details

Defined in Defunctor

Methods

demap :: ([a] -> [b]) -> a -> b Source #

Defunctor Maybe Source #

Maybe is a Defunctor.

Instance details

Defined in Defunctor

Methods

demap :: (Maybe a -> Maybe b) -> a -> b Source #