Re: [Haskell-cafe] "add ifM and whenM to Control.Monad" and other discussions like that

I haven't been around for long in the Haskell community, but I have seen a few of these discussions taking long email rounds in different mailing lists. I don't have a strong opinion at this point to add my vote here or there one way or the other, and I do appreciate the effort made by everyone to find a sort of consensus, as hard as that can be sometimes. However, the question I keep asking myself is why can't the compiler disambiguate between two definitions with the same name based on the actual argument types? This would allow packages to choose their own names for functions without such global-naming discussions and without much pain when using them. e.g.:
import PackageA (when) import PackageB (when)
when (Just True) doSomething
versus:
when True 1
Is there a theoretical or practical issue that makes this an undesirable feature in Haskell?

On Mon, Apr 21, 2014 at 3:39 PM, Yuri de Wit
I haven't been around for long in the Haskell community, but I have seen a few of these discussions taking long email rounds in different mailing lists.
I don't have a strong opinion at this point to add my vote here or there one way or the other, and I do appreciate the effort made by everyone to find a sort of consensus, as hard as that can be sometimes.
However, the question I keep asking myself is why can't the compiler disambiguate between two definitions with the same name based on the actual argument types?
This would allow packages to choose their own names for functions without such global-naming discussions and without much pain when using them.
e.g.:
import PackageA (when) import PackageB (when)
when (Just True) doSomething
versus:
when True 1
Is there a theoretical or practical issue that makes this an undesirable feature in Haskell?
It has been discussed. https://ghc.haskell.org/trac/haskell-prime/wiki/TypeDirectedNameResolution http://thread.gmane.org/gmane.comp.lang.haskell.cafe/61723 There is no clear consensus, but it is on the docket for consideration for a future version of the Haskell standard.
participants (2)
-
Alexander Solla
-
Yuri de Wit