Re: [Haskell] Type synonyms in the instance head

2006-02-03 Thread Bulat Ziganshin
Hello Mads,

Thursday, February 02, 2006, 11:48:27 PM, you wrote:

ML instance (Foo LongAndUgleName) = class something ...

ML Here again LongAndUglyName cannot be replaced by ShortAndTellingName.
ML This can be annoying if you have a lot of these instance declarations.

are you enabled -fglasgow-exts ?


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]



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


[Haskell] Type synonyms in the instance head

2006-02-02 Thread Mads Lindstrøm
Hi all

In this url
http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#id3144979
one can read about Type synonyms in the instance head. A quote:

You cannot, for example, write:

  type P a = [[a]]
  instance Monad P where ...

This design decision is independent of all the others, and easily
reversed, but it makes sense to me.

It does not make sense to me! Could anybody explain why this makes
sense?

Below, I will try to explain why it does not make sense to me.

If I have:

data LongAndUglyName a = ...
type ShortAndTellingName a = LongAndUglyName a

It seems to make sensible to:

instance Foo ShortAndTellingName

Also it is called a type _synonym_ and the type synonym and what it is
synonym for, should therefore be interchangeable.

This restriction do not only apply to instance heads, but also to
contexts, as in:

instance (Foo LongAndUgleName) = class something ...

Here again LongAndUglyName cannot be replaced by ShortAndTellingName.
This can be annoying if you have a lot of these instance declarations.

Also what the type synonym is synonym for, may not have any name and
thus properly not be telling at all, as in:

type TellingName a = \a - String

/Mads Lindstrøm


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


Re: [Haskell] Type synonyms in the instance head

2006-02-02 Thread Wolfgang Jeltsch
Am Donnerstag, 2. Februar 2006 21:48 schrieb Mads Lindstrøm:
 [...]

 Also what the type synonym is synonym for, may not have any name and
 thus properly not be telling at all, as in:

 type TellingName a = \a - String

What is \a - String?

 /Mads Lindstrøm

Best wishes,
Wolfgang
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell