One can always use a Maybe to make an IsString literal total. Perhaps this
is what library authors should do in those cases when a fromString
implementation is obviously partial.

i.e. instead of instance IsString XML where ...
define: instance IsString (Maybe XML) where ...

HTH,
Ozgur

On 24 April 2012 15:03, Yitzchak Gale <g...@sefer.org> wrote:

> Daniel Peebles wrote:
> > Why are potentially partial literals scarier than the fact that every
> value
> > in the language could lead to an exception when forced?
>
> That's a legitimate question, but it's strange to hear it from
> you.
>
> People ask that same question about Haskell's static
> type system. Why bother? Every value could lead to an
> exception when forced. So we might as well check
> everything at run time.
>
> Wouldn't it be ironic if the one thing that every language
> other than Haskell is able to check at compile time,
> namely the static syntax of string literals, could only be
> checked at run time in Haskell? Especially when, with just
> a little care, we could easily continue to check it at compile
> time while still supporting string literals of type Text
> and ByteString.
>
> I guess I'm just not understanding your question.
>
> Thanks,
> Yitz
>
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to