Package data-type contains a number of fundamental types and classes useful
for type-level programming, such as type-level booleans, natural numbers,
and lists. All of them could no doubt be found elsewhere, including the
HList package[1,2], but this package aims to make them more accessible.
It is a prerequisite for the other two packages.
Package function-combine is the outcome of an exercise in type-level
programming (e.g. [3, 4]). It illustrates implementations of
* A popular generalisation of function composition
-- compose zero = (.)
-- compose zero f g x = f (g x)
-- compose one f g x y = f (g x y)
* A generalisation of flip
-- passes its first argument as the (n + 1)th argument
-- to , rotating the intervening arguments along
-- e.g. = flip
It is published primarily for reference purposes, as [yet] an[other]
of the techniques involved. If somebody happens to find it useful in its
own right, so much the better.
Package flexiwrap is a more substantial use of these techniques,
together with phantom types , to provide
a system of flexible wrappers, intended to facilitate the definition of
types which have specified typeclass instances, which is particularly
with composed types (see e.g. ). Automatic instance derivation
generally assume that there is only one appropriate candidate, which is
frequently not the case for composed types, whereas flexible wrappers
allow you to specify the required instance by name. In particular,
an illustrative implementation of the Mark Jones / Luc Duponcheel scheme
for monad composition is provided.
As a taster,
type StrictT = FWCTC
FWCompMonadPlusL :*: FWCompDefaults :*: FWCompS :*: TNil
(FlipT O) Strict
defines a (e.g. monad, but in general constructor) transformer StrictT.
FWCTC is a flexible wrapper. Its first parameter is an HList-like
list of instance specifications. O is the type composition operator,
and FlipT flips its arguments. Strict is a user-defined constructor type.
FWCompMonadPlusL specifies a particular MonadPlus instance, and FWCompS
specifies the Jones/Duponcheel SComp construction . The other two items
in the list (apart from the TNil terminator) specify default
of other instances.
All three packages should be considered experimental. The flexiwrap
in particular is provided as a proof of concept - only enough typeclass
instances are provided to illustrate the idea, and many other details
are likely to change. They will work with a wide range of versions of GHC,
but probably not other compilers.
 I don't know any good reference for the current usage of the term
phantom types - I may yet write one.