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

John Lato jwlato at
Mon Jul 15 02:20:44 CEST 2013

On Fri, Jul 12, 2013 at 7:25 PM, Gabriel Gonzalez <gabriel439 at>wrote:

> On 07/12/2013 02:03 AM, John Lato wrote:
>> In all seriousness, I'm not that fond of the proposal myself.  I just
>> wanted to argue the other side because nobody else was.
> I appreciate that! :)  I, too, enjoy playing the devil's advocate.
>  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, which had a
>> great deal of support.
> There is a difference between type-classing `fmap` and type-classing
> string literals.  `fmap` has laws governing its behavior that preserve a
> certain intuition and keep the instance writer on the straight and narrow
> path.
> Speaking of which, it would be an improvement if `fromString` instances
> some sort of functor laws, even if they were not totally rigorous and the
> destination category is changing on an instance-by-instance basis.  For
> example, the `String`/`Text`/`ByteString` instances for `fromString` should
> obey (or *mostly* obey) these laws:
>     fromString (str1 <> str2) = fromString str1 <> fromString str2 ::
> Vector Char/Text/ByteString
>     fromString mempty = mempty

None of this addresses my argument.  That is, you (and most others) want to
use IsString to denote things that are in some sense strings.  This
proposed distribution of fromstring over mappend is a reasonable attempt to
formalize what it means to be string-like.  But my point is that this may
be the wrong intuition.  I don't see any reason why IsString should be
restricted to just notional strings.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list