Why no multiple default method implementations?
Bas van Dijk
v.dijk.bas at gmail.com
Thu Nov 24 10:23:58 CET 2011
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?
Regards,
Bas
More information about the Glasgow-haskell-users
mailing list