projection-0.1: Projection function for arbitrarily nested binary product types.

Copyright(c) 2014 Patrick Bahr
LicenseBSD3
MaintainerPatrick Bahr <paba@di.ku.dk>
Stabilityexperimental
Portabilitynon-portable (GHC Extensions)
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Projection

Description

This module provides a generic projection function pr for arbitrary nested binary products.

Synopsis

Documentation

pr :: forall e p. e :< p => p -> e Source

This function projects the component of type e out or the compound value of type p.

type (:<) e p = GetPointer (Elem e p) e p Source

The constraint e :< p expresses that e is a component of the type p. That is, p is formed by binary products using the type e. The occurrence of e must be unique. For example we have Int :< (Bool,(Int,Bool)) but not Bool :< (Bool,(Int,Bool)).