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

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
8 Feb 2001 20:51:57 GMT


Thu, 08 Feb 2001 15:11:21 +0100 (CET), Elke Kasimir <elke.kasimir@catmint.de> 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
synonym".

> 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
enough...

-- 
 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK