foldr in terms of map

2003-06-30 Thread Hal Daume
Kind of a random question for today :). We all know that we can write map in terms of foldr: > map f = foldr ((:) . f) [] as I understand it, this is essentially because foldr encapsulates all primitive recursive functions and since map is primitive recursive, we can implement it in terms of a f

RE: Language extension proposal

2003-06-30 Thread C T McBride
Hi > There's nothing wrong with this in principle; the difficulty is that > when you say > > mantissa + 4 > > you aren't saying which float type to get the mantissa of. Earlier > messages have outlined workarounds, but in some ways the "real" solution > is to provide a syntax for type appli

Re: Language extension proposal

2003-06-30 Thread Ashley Yakeley
At 2003-06-30 01:55, Ralf Hinze wrote: >What about > mantissa (| Double |) + 4 ? This would work perfectly with my method if (| Double |) were syntactic sugar for (mkType :: Type Double) or similar. I really think it's the most straightforward way of doing it and I hazard the easiest to

Re: Language extension proposal

2003-06-30 Thread Ralf Hinze
> If we could only figure out a good syntax for > (optional) type application, it would deal rather nicely with many of > these cases. Trouble is, '<..>' gets confused with comparisons. And > when there are multiple foralls, it's not obvious what order to supply > the type parameters. What about

RE: Language extension proposal

2003-06-30 Thread Simon Peyton-Jones
If you have a class like this class FloatTraits a where mantissa :: Int then the type of mantissa is mantissa :: forall a. FloatTraits a => Int There's nothing wrong with this in principle; the difficulty is that when you say mantissa + 4 you aren't saying wh