Proposal: Add &&& and *** to Data.Tuple
Ian Lynagh
igloo at earth.li
Mon Sep 17 15:20:23 EDT 2007
On Mon, Sep 17, 2007 at 07:47:33PM +0100, Jon Fairbairn wrote:
> Ian Lynagh <igloo at earth.li> writes:
>
> > On Mon, Sep 17, 2007 at 03:23:46PM +0200, Josef Svenningsson wrote:
> >>
> >> It is becoming increasingly popular to import Control.Arrow just to
> >> get access to the functions &&& and *** specialized to the function
> >> arrow. I propose to add the specialized version of these two functions
> >
> > I think that having the same function with different types is likely to
> > cause user confusion, and also ambiguous function errors.
> >
> > (I also think that using a different name for the specialised versions
> > would be a bad idea.)
>
> This seems to be a recurrent problem, and I keep wondering
> whether there might not be a general solution along the
> lines of declaring that an instance of a class at a
> particular type subsumes the functions declared with those
> names at the specialised type.
An interesting idea; I'm not sure, but I think it might help us have
code in the logical place in the base library without import loops.
The only ugliness I see is that if I have
module I where
x :: Int
x = 5
module B where
x :: Bool
x = True
module C where
import I
import B
class C a where
x :: a
instance C Int where
x subsumes I.x
instance C Bool where
x subsumes B.x
then importing I and B but not C could lead to confusion and ambiguity.
Thanks
Ian
More information about the Libraries
mailing list