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

Evan Laforge qdunkan at
Fri Jul 12 09:57:44 CEST 2013

On Fri, Jul 12, 2013 at 2:45 AM, John Lato <jwlato at> wrote:
> On Fri, Jul 12, 2013 at 2:13 PM, Roman Cheplyaka <roma at> wrote:
>> * John Lato <jwlato at> [2013-07-12 13:56:31+0800]
>> > The programmer is being explicit; the type specifies the value is a
>> > Maybe.
>> >  If it weren't, the Just wouldn't be inserted.
>> Not necessarily — take Simon's original example:
>>   (shell "ls -l") { cwd = "/home/me" }
>> If I didn't know the type of 'cwd', it would never occur to me while
>> reading this code that you can supply Nothing there.
> So?  If you're just reading the code, it doesn't matter.  If you want to

It does to me!  Concrete types help me read.  I have a lot of trouble
understanding libraries that make extensive use of typeclasses, both
reading their documentation and reading code that uses them.

> OverloadedStrings (and number literals) are already a mess for this.
> Currently, we have
>     (shell "ls -l") { cwd = Just "/home/me" }
> If I want to replace that literal with a value and I don't know the type of
> 'cwd', I already need to look it up.  Otherwise I might try to do something
> like this:
>     dirFromUser <- Text.getLine
>     (shell "ls -l") { cwd = Just dirFromUser }

I probably wouldn't, because I know the process package uses Strings.

In general though I agree, with overloading there's a bit of a mess,
but that's not license to expand the mess.

> A decent IDE helps a lot if you don't know the types of things in your code.
> Everyone should use one.

It sounds reasonable in theory, but I've never seen an IDE I would
call "decent".

More information about the Libraries mailing list