Re: [Haskell-cafe] Why were unfailable patterns removed and fail added to Monad?

2012-01-19 Thread Luminous Fennell
On Fri, Jan 20 2012 at 06:22 +0100, Evan Laforge wrote:

 On Thu, Jan 19, 2012 at 8:53 PM, Edward Z. Yang ezy...@mit.edu wrote:
 It's not obvious that this should be turned on by -Wall, since
 you would also trigger errors on uses like:

   [ x | Just x - xs ]

 [...]
  I would have suggested that listcomp
 match failures yield [] but monad ones be errors, but now that list
 comps and monads are back together again maybe that's not so easy to
 do...


Perhaps a generalization of this would be to warn only if fail was
inherited by the original Monad typeclass, where it seems obvious that
fail takes the role of a ``work-around''. When fail is overwritten one
could perhaps assume that calling it is the intended behavior for
pattern match failures.

Lu

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-09 Thread Luminous Fennell
Hi,

On Mon, Jan 09 2012 at 10:37 +0100, Steve Horne wrote:
 On 08/01/2012 21:13, Brandon Allbery wrote:

 (Also, de facto I think it's already more or less been decided in
 favor of type families, just because functional dependencies are (a)
 a bit alien [being a glob of Prolog-style logic language imported
 into the middle of System Fc] and (b) [as I understand it] difficult
 to verify that the code in the compiler is handling all the
 potential corner cases right [mainly because of (a)].


 Isn't Haskell doing some prolog-ish things anyway?

 I thought the compiler must be doing unification to resolve type
 inference within expressions. 

Even quite basic type reconstruction (e.g. for ML) needs unification, see e.g. 
Pierce
TaPL chapter 22. The algorithm is rather easy to understand and implement.

Based on that, I wouldn't think using /some kind of unification/ in the
compilation process qualifies as being particularly prolog-ish. I
suppose ``...importing a Prolog-style logic language...'' would mean to
allow a significantly more powerful (and explicit) way of expressing
constraints in the type system than before. I believe Brandon Allbery,
when he says that this is difficult.

Best regards

Lu

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe