Thanks for all the pointers, guys. You've been very helpful.
I also found Type-indexed data types (Hinze et al) to be a good source.
Much appreciated!
Martijn.
Martijn van Steenbergen wrote:
data ExprF r
___
Haskell-Cafe mailing list
Haskell-Cafe
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 r
Martijn van Steenbergen 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 ot
Obviously you are modelling the datatype
-- data Expr = Add Expr Expr | Sub Expr Expr | Mul Expr Expr | Div
Expr Expr | Num Int
You already have ExprF, and now you need to throw in Fix
newtype Fix f = In (f(Fix f))
in order to be able to build Expr like terms.
type Expr' = Fix ExprF
add a
Conor also calls these functors:
http://strictlypositive.org/slicing-jpgs/
"The fixpoint construction builds recursive types (think trees) from
functors by identifying superstructures with substructures: each node
frames its children. "
___
Haskell-Cafe
Hi,
On Thursday 22 October 2009 09:47:32 Martijn van Steenbergen 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
> 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.
>>
>
> Tim Sheard and Emir Pasalic call this technique "two-level types" in their
> JFP'04 paper Two-Level Types and Parameterized Modules:
>
Hi Martijn,
On Oct 22, 2009, at 9:47 AM, Martijn van Steenbergen wrote:
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.
Tim Sheard and Emir Pasalic call this technique "two-level types" in
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