Malcolm.Wallace at cs.york.ac.uk
Tue Nov 21 06:46:38 EST 2006
"Josef Svenningsson" <josef.svenningsson at gmail.com> wrote:
> > If anyone actually uses explicit defaults in their programs, I would
> > be interested in seeing some real data on this.
> Ah, another fine opportunity to use Google Code Search. And even more
> so now that it supports Haskell code!
An excellent suggestion, thank you!
Several things strike me about this data:
* Very few projects use defaulting (only 30 results show up, and I am
the author of 6 of those).
* I had forgotten about the important need to turn _off_ defaulting
(now added to my proposal).
* Extant uses fall into 3 main categories:
. turning off defaults because Hat and Buddha cannot handle them well
. changing default(Integer) to default(Int) for compatibility with
pre-Haskell-1.4 behaviour, or for performance reasons (in Hugs)
. introducing a new numeric type (e.g. GLfloat, Number)
Of course, what the extant data cannot show is how authors would _like_
to have used defaulting, but were prevented from doing so by the
language spec. Well, maybe the Hat and Buddha examples hint at it.
I can also imagine that it would be useful to have per-class defaults
for user-defined classes in something like QuickCheck or SmallCheck. It
is tedious to need to add to your property specification some exact type
signature to constrain the polymorphic values such that the system can
generate some of them. It would be so much easier to be able to say
default Arbitrary Int
default Serial Bool
and then the system could generate appropriate test cases without the
extra human work of adding lots of signatures.
P.S. updated proposal here:
More information about the Haskell-prime