[Haskell-cafe] Why I Love Haskell In One Simple Example

Claus Reinke claus.reinke at talk21.com
Fri Jun 24 19:14:40 EDT 2005

> I recently implemented some new Haskell numeric types that, instead of
> performing calculations, can generate a rendering of the requested
> calculation or store units with it.

good old Haskell rule (with apologies to Daniel Düsentrieb, I think;):
"impossible things are delayed immediately, miracles may take a little longer"

you can't get an expression representation from a value, but you can
generate a representation while building the expression, so that you
have it at hand if/when needed. I did something similar once (pairing
values with representations instead of calculating values from
representations), which you might find interesting for comparison
(note that the focus in this one was on simplicity, eg. string
representation only, no simplification, etc.):


btw, that kind of thing gets even more interesting with ho-functions
like foldr, foldl, map. try it!-) nice for explaining these hofs..

(the code still works, but if you use ghci -fglasgow-exts instead of
hugs +98, the defaulting doesn't seem to kick in, so you'll need to
give explicit type annotations, eg. "map (+) [1..4::R Integer]" or
"foldl (-) 0 [1..4::R Integer]").


Do you have late-breaking research results in FP but have missed
the other deadlines? Submit to TFP'05: http://www.tifp.org/tfp05/
extended abstracts: 8th July 2005     <====
full papers: 2nd September 2005
symposium: 23/24 September 2005, Tallinn, Estonia (w.ICFP/GPCE)

More information about the Haskell-Cafe mailing list