Show, Eq not necessary for Num [Was: Revamping the numeric c

Marcin 'Qrczak' Kowalczyk
8 Feb 2001 20:51:57 GMT

Thu, 08 Feb 2001 15:11:21 +0100 (CET), Elke Kasimir <> pisze:

> However, what is missing for me is something like:
> type Comfortable a = (Show a, Eq a, Num a) => a
> or
> class (Show a, Read a, Eq a) => Comfortable a
> instance (Show a, Read a, Eq a) => Comfortable a 

I agree and think it should be easy to add.

The latter syntax is nice: obvious what it means, not legal today.
This instance of course conflicts with any other instance of that
class, so it can be recognized and treated specially as a "class

> For Haskell, I could imagine (without having having much thought
> about) in addition to the things mentioned in the beginning,
> several things making supporting the  "locally, fast and easy",
> including a mean to define classes with implied memberships, for
> example declarations saying that "Foo is the class of all types in
> scope for which somefoo :: ... is defined", or declarations saying
> that "class Num is locally restricted to all instances of global
> Num which also belong to Eq".

Here I would be more careful. Don't know if local instances or local
classes can be defined to make sense, nor if they could be useful

 __("<  Marcin Kowalczyk *
  ^^                      SYGNATURA ZASTĘPCZA