default instance for IsString
ozgurakgun at gmail.com
Wed Apr 25 11:39:12 CEST 2012
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 ...
On 24 April 2012 15:03, Yitzchak Gale <gale at sefer.org> wrote:
> Daniel Peebles wrote:
> > Why are potentially partial literals scarier than the fact that every
> > in the language could lead to an exception when forced?
> That's a legitimate question, but it's strange to hear it from
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Glasgow-haskell-users