Re: [Haskell-cafe] Typing efficient folds

2009-04-27 Thread Matthew Brecknell
Keith Battocchi wrote: > data Nest a = Nil | Cons(a, (Nest (Pair a))) > type Pair a = (a,a) > > pair f (a,b) = (f a, f b) > > efold :: forall n m b. > (forall a. n a) > -> (forall a . (m a, n (Pair a)) -> n a) > -> (forall a. Pair (m a) -> m (Pair a)) > -> (forall l z. (l b -> m (z b))

Re: [Haskell-cafe] Typing efficient folds

2009-04-25 Thread Brent Yorgey
On Fri, Apr 24, 2009 at 06:52:09PM +, Keith Battocchi wrote: > I'm trying to write some code to do folds on nested datatypes as in > http://web.comlab.ox.ac.uk/people/Jeremy.Gibbons/publications/efolds.pdf but > running into trouble getting things to typecheck. > > Given the types > > data

[Haskell-cafe] Typing efficient folds

2009-04-24 Thread Keith Battocchi
I'm trying to write some code to do folds on nested datatypes as in http://web.comlab.ox.ac.uk/people/Jeremy.Gibbons/publications/efolds.pdf but running into trouble getting things to typecheck. Given the types data Nest a = Nil | Cons(a, (Nest (Pair a))) type Pair a = (a,a) and the following