monadiccp-0.7.7: Constraint Programming

Safe HaskellSafe



Module with basic infrastructure for function inheritance based on open rercusion.

See the work of William Cook.

We use the following terminology.

  • A closed function is an ordinary function.
  • A mixin function is an open function that can be inherited from, or that extends another open function.

We obtain a closed function from a base mixin base and a number of mixin extensions e1,...,en as follows:

 mixin (en <@> ... <@> e1 <@> base)



type Mixin a = a -> a -> a Source #

Type of mixin functions.

(<@>) :: Mixin a -> Mixin a -> Mixin a infixl 5 Source #

Mixin composition.

mixin :: Mixin a -> a Source #

Turn a mixin into a closed function.

mixinId :: Mixin a Source #

Mixin identity function.

Identity for mixin composition:

mixinId <@> f  ==  f
f <@> mixinId  ==  f

mixinLift :: (a -> b) -> Mixin (a -> b) Source #

Mixin lift function

mixin . mixinLift = id