Overlapping, undecidable, incoherent -- or worse?
simonpj at microsoft.com
Thu May 20 18:49:38 EDT 2004
Actually, you're right, GHC will infer the type you suggest. GHC is
lazy, and tries to postpone context reduction as long as possible, until
forced by some user-supplied context. But I don't think that makes the
subtleties go away.
| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org
| bounces at haskell.org] On Behalf Of Stefan Reich
| Sent: 20 May 2004 13:48
| Cc: glasgow-haskell-users at haskell.org
| Subject: Re: Overlapping, undecidable, incoherent -- or worse?
| Simon Peyton-Jones wrote:
| > As a trivial example, try
| > f a = a |= a
| > What type shall we infer for f?
| > f :: (Bounded a, Enum a, SemiRing a) => a -> a
| > or
| > f :: (CSemiRing a) => a -> a
| This has always confused me - GHC always seems to use the strongest
| possible conditions when inferring types (CSemiRing is stronger than
| because it implies it). Why isn't the type just
| f :: (PO a) => a -> a
| ? Isn't this the most straight-forward (and universal) typing,
| especially in the presence of overlapping/undecidable instances?
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
More information about the Glasgow-haskell-users