Proposal: Add IsString instance for (Maybe a) to base

Roman Cheplyaka roma at ro-che.info
Fri Jul 12 12:29:43 CEST 2013


* John Lato <jwlato at gmail.com> [2013-07-12 17:03:03+0800]
> In all seriousness, I'm not that fond of the proposal myself.  I just
> wanted to argue the other side because nobody else was.  But so far, I've
> seen two main arguments against the proposal:
> 
> 1.  IsString is for things that are notionally some sort of string.
> 2.  It makes the types more confusing.
> 
> The second seems like a weak argument to me.  First off, the proposal seems
> very similar to the recent generalization of Prelude.map, which had a great
> deal of support.

The difference is that fromString is called implicitly.

A similar precedent is numeric literals. When I type 1, a method is
called, but most of the time I don't need to think about it because
those methods agree with my intuitive semantics of numbers.

It's easy to define a more or less proper instance

  instance (Applicative t, Num n) => Num (t n)

which would allow to overload numbers even harder, but then I'd need to
stop and think every time I see a number.

Roman



More information about the Libraries mailing list