OverloadedLists

Isaac Dupree ml at isaac.cedarswampstudios.org
Fri Feb 15 20:59:49 CET 2013


On 02/15/2013 03:52 AM, Simon Peyton-Jones wrote:
> | Does this mean that if OverloadedLists is on and more than one fromList
> | or toList is in scope (even if one of them is GHC.Exts.fromList/toList),
> | then list literals and patterns (resp.) will not compile?
>
> No... the documentation is poor on that point:
>
> * Normally, it'll use GHC.Exts.fromList (etc) regardless of
>    whether GHC.Exts is imported, or what other fromList's are in scope.
>
> * If you also use -XRebindableSyntax, it'll use whatever fromList is in scope.
>    Then if you imported Data.Map and GHC.Exts it'd be ambiguous.
>
> This is precisely the behaviour of, say integer literals.  Normally they desugar to a call of the Prelude's fromInteger, but with RebindableSyntax it becomes whatever fromInteger is in scope.
>
> I'll fix the documentation.
>
> Simon

Ah, that's what I'd expect.  Thanks!

-Isaac





More information about the ghc-devs mailing list