On Wed, Nov 18, 2009 at 4:12 PM, Edward Kmett <ekm...@gmail.com> wrote:
>
> Qualified imports are some times problematic when you need to work with
> classes from the module. You can't define a member of two instances from
> different two modules that define classes with conflicting member names.
> This can lead to situations where you have no option but to have orphan
> instances.
>
> module Bar where
> class Foo a where
>    foo :: a
>
> module Baz where
> class Quux a where
>   foo :: a
>
> module Quaffle where
> import qualified Bar
> import qualified Baz
>
> instance Bar.Foo Int where
>   Bar.foo = 1
> -- ^- syntax error.
>
> instance Baz.Quux Int where
>   Baz.foo = 2
>
> I suppose this could possibly be fixed if something deep in the parser
> allowed a QName there.

Try Quaffle without the qualifications.

> module Quaffle where
> import qualified Bar
> import qualified Baz
>
> instance Bar.Foo Int where
>   foo = 1
>
> instance Baz.Quux Int where
>   foo = 2


-- 
Dave Menendez <d...@zednenem.com>
<http://www.eyrie.org/~zednenem/>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to