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

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Wed Jul 10 01:21:28 CEST 2013


On 10 July 2013 07:24, Simon Hengel <sol at typeful.net> wrote:
> Hi,
> what about adding
>
>     instance IsString a => IsString (Maybe a) where
>       fromString = Just . fromString
>
> It makes specifying optional String/Text/... values more convenient.
> Here is an example that uses System.Process.shell:
>
> Use
>
>     shell "ls -l" { cwd = "/home/me" }
>
> instead of
>
>     shell "ls -l" { cwd = Just "/home/me" }
>
> I'm not yet sure how essential it is.  But I somehow can't see any
> issues with it.  So why not?

-0.5 from me; I think it's too easy to forget that it's a Maybe value
there when refactoring, etc.

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
http://IvanMiljenovic.wordpress.com



More information about the Libraries mailing list