[Haskell-cafe] Principal type in Haskell

william kim haskelllist at hotmail.com
Thu Jun 22 13:12:44 EDT 2006


Thanks. Do I therefore able to conclude that none of the reductions using 
instance declarations are not performed because of potential overlapping 
instances?

william

>From: Bulat Ziganshin <bulat.ziganshin at gmail.com>
>Reply-To: Bulat Ziganshin <Bulat.Ziganshin at gmail.com>
>To: "william kim" <haskelllist at hotmail.com>
>CC: haskell-cafe at haskell.org
>Subject: Re: [Haskell-cafe] Principal type in Haskell
>Date: Thu, 22 Jun 2006 14:28:14 +0400
>
>Hello william,
>
>Thursday, June 22, 2006, 1:22:32 PM, you wrote:
>
>
> > GHCi yields type f :: (Eq [a]) => a -> a -> Bool.
>
> > But according to the paper "Type classes: an exploration of the design
> > space", predicate Eq [a] should be reduced to Eq a. Is this reduction
> > performed here? What should be the principal type of f?
>
>Ghc, unlike H98, supports instances like this:
>
>instance Eq [MyType] where
>   a==b = True
>
>so this extension to type inference allows to use such instance even
>if MyType is not in Eq class
>
>
>--
>Best regards,
>  Bulat                            mailto:Bulat.Ziganshin at gmail.com
>

_________________________________________________________________
Find love on MSN Personals http://personals.msn.com.sg/



More information about the Haskell-Cafe mailing list