Hi Bas, On Thu, Nov 24, 2011 at 09:23, Bas van Dijk <v.dijk....@gmail.com> wrote:
> Hello, > > Now that we have DefaultSignatures, why is it not allowed to have > multiple default method implementations, as in: > > {-# LANGUAGE DefaultSignatures #-} > > class Foo a where > foo :: a > foo = error "foo" > > default foo :: Num a => a > foo = 1 > > GHC complains: "Conflicting definitions for `foo'" > > The following use of multiple default signatures also gives the same error: > > class Foo a where > foo :: a > > default foo :: Fractional a => a > foo = 0.5 > > default foo :: Num a => a > foo = 1 > > Couldn't GHC always pick the most specific default method, just as it > does with instances when OverlappingInstances is enabled? > As far as I understand, GHC never looks at the context to decide which instance is applicable: http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/type-class-extensions.html#instance-overlap Your instances above are duplicates. Cheers, Pedro > Regards, > > Bas > > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users@haskell.org > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users >
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users