[Haskell-cafe] Re: [Haskell] View patterns in GHC: Request?for?feedback

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Wed Aug 1 06:06:09 EDT 2007


David Roundy <droundy at darcs.net> writes:

> On Mon, Jul 30, 2007 at 11:47:46AM +0100, Jon Fairbairn wrote:
> > [snippage] This is all very horrid, but as far as I can tell
> > what I was proposing wouldn't lead to such a mess, except
> > possibly via defaulting, which, as the least important
> > aspect of the idea could easily be abandoned.
> 
> What your suggestion would do would be to make the type inferred for every
> pattern-matched function polymorphic,

No it wouldn't. I reiterate: constructors would either
belong to a class or to a datatype, so for constructors that
belong to a datatype the situation would be exactly as
before.

It's unfortunate that when I wrote my example I assumed that
everyone would understand that for some classes we would
have defaults (because we already have this: the
constructors for Integer effectively belong to a class and
are defaulted to Integer). I'm now quite convinced that
using defaults together with more general overloaded
constructors would be a mistake, but that's all you've
managed to convince me of!

Yes, there is a problem that importing a class with a
constructor into a scope that declares the same constructor
as a data constructor would cause difficulties (namely the
module would nolonger compile), but aren't they exactly the
same difficulties as when the name in question is just a
function name?

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk



More information about the Haskell-Cafe mailing list