[Haskell-cafe] class method name scope

Luke Palmer lrpalmer at gmail.com
Thu Dec 4 19:50:34 EST 2008

No deep inheritance?  Then what's the problem?

module X where
class Foo a where foo :: a -> String

module Y where
class Foo' a where foo :: a -> String

module Main where
import qualified X
import qualified Y

instance X.Foo Int where foo _ = "X"
instance Y.Foo' Int where foo _ = "Y"

It is known that the first foo is referring to X.foo, and the second is
referring to Y.foo.

In fact... come to think of it, there are actually no namespace problems.
The instance syntax is just a little quirky, since you don't qualify the
LHS, even if the name is only imported qualified.

Or is that not what you're referring to?


On Thu, Dec 4, 2008 at 5:43 PM, Jason Dusek <jason.dusek at gmail.com> wrote:

>  It's not that I like to have a lot of methods in a class, but
>  rather a lot of classes.
> --
> _jsn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081204/9dbe0a1c/attachment.htm

More information about the Haskell-Cafe mailing list