- Haskell would need to be a lot more specific about exactly where
context reduction takes place. Consider
f xs x = xs == [x]
Do we infer the type (Eq a) = [a] - a - Bool? Thereby committing to
a particular choice of instance? Or do we (as GHC does) infer the type
(Eq [a]) = [a] - a - Bool, so
there were a couple of issues Simon raised that I hadn't responded to in
my earlier reply. since no-one else has taken them on so far, either, ..
- Haskell would need to be a lot more specific about exactly where
context reduction takes place. Consider
f xs x = xs == [x]
Do we infer the type
Niklas Broberg wrote:
Ben Rudiak-Gould wrote:
Are there uses of overlapping
instances for which this isn't flexible enough?
Certainly!
Hmm... well, what about at least permitting intra-module overlap in Haskell'
(and in GHC without -foverlapping-instances)? It's good enough for many
Ben Rudiak-Gould wrote:
I think all of these problems would go away if overlap was permitted
within a module but forbidden across modules. Are there uses of
overlapping instances for which this isn't flexible enough?
I dislike this on principle. I like the idea that modules can be
instance C2 a b | a/=b
I was thinking it would be all kinds of useful if we had two predefined
classes
class Eq a b
class NEq a b
where Eq has instances exactly when its two types are equal and NEq has
instances exactly when its two types are not equal.
class Eq a b
instance Eq a a
On 2/28/06, Ben Rudiak-Gould [EMAIL PROTECTED] wrote:
Simon Peyton-Jones wrote:
- A program that type checks can have its meaning changed by adding an
instance declaration
- Similarly adding import M() can change the meaning of a program (by
changing which instances are visible
-
Claus Reinke wrote:
most of us would be happy if instance contexts
would be required to uniquely determine the instance to be
chosen, a rather conservative extension of current practice.
I'm not so sure about the most of us, as you note yourself the
defaulting pattern is quite popular (and
Overlapping instances are undoubtedly useful, but they raise lots of
interesting questions. Such as
- A program that type checks can have its meaning changed by adding an
instance declaration
- Similarly adding import M() can change the meaning of a program (by
changing which instances are
[
I'll only address some of your issues in this message, as they fall nicely
under the use of a feature I'd like to see anyway:
type disequality constraints
]
- A program that type checks can have its meaning changed by adding an
instance declaration
- Similarly adding import M() can
On Mon, Feb 27, 2006 at 05:09:30PM +0300, Bulat Ziganshin wrote:
i had plans to propose the same and even more:
instance C2 a b | a/=b
I was thinking it would be all kinds of useful if we had two predefined
classes
class Eq a b
class NEq a b
where Eq has instances exactly when its two types
10 matches
Mail list logo