[Haskell-cafe] Status of TypeDirectedNameResolution proposal?

Edward Kmett ekmett at gmail.com
Wed Nov 18 16:35:56 EST 2009


Thanks! Learn something new every day. =)

-Edward Kmett

On Wed, Nov 18, 2009 at 4:29 PM, David Menendez <dave at zednenem.com> wrote:

> On Wed, Nov 18, 2009 at 4:12 PM, Edward Kmett <ekmett at 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 <dave at zednenem.com>
> <http://www.eyrie.org/~zednenem/ <http://www.eyrie.org/%7Ezednenem/>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091118/a193a690/attachment.html


More information about the Haskell-Cafe mailing list