shapely-data-0.1: Generics using @(,)@ and @Either@, with algebraic operations and typed conversions

Safe HaskellNone

Data.Shapely.Spine

Contents

Synopsis

Constructing a type's Spine

class SpineOf ts whereSource

The "spine" of some Shapely instance type can be specified by enumerating the types of its recursive subterms in a Product of Proxy values. For instance the spine of data L = Cons Int L | Empty would simply be

 (Proxy :: Proxy L, ())

When parameterized types make up the recursive structure, like [a] one can specify the spine using just the base type (in this case []), e.g.

 (Proxy :: Proxy [], ())

...or the base type applied as far as desired and functions using this spine will match potential product terms accordingly (e.g. coerceWith).

See proxy-kindness for utilities useful fo constructing Spines, e.g. unappliedOf.

Methods

spine :: tsSource

Allows for terse definition of the cluster of types that make up a type's spine. E.g.

 sp = spine :: (Foo ':-:' Bar ':-!' Baz)

Instances

SpineOf () 
(Shapely tab, Applied k t tab, SpineOf ts) => SpineOf (Proxy k t, ts) 

type :-: t ts = (Proxy t, ts)Source

type :-! t1 t2 = (Proxy t1, (Proxy t2, ()))Source

Working with Proxys

module Data.Proxy

proxyTypeOf :: a -> Proxy aSource

 proxyTypeOf = return