[Haskell-cafe] Language extensions [was: Memoization]
Philippa Cowderoy
flippa at flippac.org
Sun May 27 16:58:57 EDT 2007
On Sun, 27 May 2007, Andrew Coppin wrote:
> I'm thinking more about things like phantom types, rank-N polymorphism,
> functional dependencies, GADTs, etc etc etc that nobody actually understands.
>
I think you'll find a fair number of people do in fact understand them!
> This worries me greatly. I'm really afraid that Haskell will go from being
> this wonderful, simple language that you can explain in a page or two of text
> to being this incomprehensible mass of complex type machinery that I and most
> other human beings will never be able to learn or use. :-(
>
So don't use type extensions in your own code? It's comparatively rare to
have any big problems using libraries that make use of them - I remember
banging my head briefly the first time I used ST as a newbie, but that was
about it.
> What worries me is the day when you'll need to understand set theory and
> propositional calculus just to use any of the standard libraries.
It would be no bad thing if people were less scared of them and just
learned - they're not complicated.
> (Already I
> can't use the State monad because it requires some extension or other. Not
> that I understand why - as far as I can tell, it's 100% possible to define a
> State monad without language extensions. The library just doesn't, that's all.
> Well, I can always define my own I guess...)
>
The library doesn't because defining a sufficiently generic notion of
State monad (enough so that we can treat a more complex monad that
also has a notion of state the same way) requires the extensions. It's all
about the polymorphism - one of the reasons Haskell code stays simple is
that the amount of polymorphism possible makes people less keen on writing
massive overbearing frameworks.
--
flippa at flippac.org
There is no magic bullet. There are, however, plenty of bullets that
magically home in on feet when not used in exactly the right circumstances.
More information about the Haskell-Cafe
mailing list