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

2009-10-23 Thread Edward Kmett
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

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

2009-10-23 Thread Martijn van Steenbergen
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] What's this pattern called?

2009-10-22 Thread Martijn van Steenbergen
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

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

2009-10-22 Thread Sebastian Fischer
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

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

2009-10-22 Thread Sean Leather
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:

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

2009-10-22 Thread Daniel Schüssler
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 what is it called?

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

2009-10-22 Thread George Pollard
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

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

2009-10-22 Thread Jose Iborra
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

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

2009-10-22 Thread wren ng thornton
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