[Haskell-cafe] What's this pattern called?

Edward Kmett ekmett at gmail.com
Fri Oct 23 02:00:35 EDT 2009


I've often seen it referred to as the base functor for a recursive data
type. You can then fix that functor in interesting ways i.e. with (Fix,
Free, Cofree) and having the explicit base functor allows you to define
general purpose recursion schemes over the data type. All of that extra
machinery relies on your recursive data type being implemented as a functor
with an explicit fixpoint, so base 'functor' seems quite appropriate.

-Edward Kmett

On Thu, Oct 22, 2009 at 3:47 AM, Martijn van Steenbergen <
martijn at van.steenbergen.nl> wrote:

> Bonjour café,
>
>  data ExprF r
>>  =  Add  r  r
>>  |  Sub  r  r
>>  |  Mul  r  r
>>  |  Div  r  r
>>  |  Num  Int
>>
>
> This is a well-known pattern that for example allows nice notation of
> morphisms. But what is it called? I've heard fixed-point view, open
> datatypes and some others, but I'm curious where this pattern comes up in
> literature and what it is called there.
>
> Thanks,
>
> Martijn.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091023/6499492b/attachment.html


More information about the Haskell-Cafe mailing list