[web-devel] xml-types IsString instance for Name causes crashes

John Millikin jmillikin at gmail.com
Tue Jun 7 22:37:54 CEST 2011


On Tue, Jun 7, 2011 at 08:51, Yitzchak Gale <gale at sefer.org> wrote:
> Since the whole idea of xml-types is for it to be a
> unifying standard, I'd like to see it usable in that kind
> of environment, too.

It is usable in such an environment -- simply do not use the IsString instance.

> In addition, I have already pointed out that semantically
> it doesn't make sense for a fromString implementation
> to return _|_. And it is easy to make a small change
> to the current implementation to avoid that.
>
> So let me turn the question around. Is there a compelling
> reason why, in some use case, the fromString must
> return _|_, rather than returning some text that will allow
> the application to handle the situation itself?

The string "foo}bar" is invalid; it must *never* be converted to a
Name. Doing so would cause silent, unpredictable failures which cannot
be tested for.

IsString does not support reporting parse errors; therefore, any
IsString instance for Name must be partial.

if you're very concerned about it, I could add a flag like
"NoIsString" which disables that particular instance. You could enable
it in your build scripts.

However, I will not implement a change which can cause arbitrary
silent failure with no obvious cause.



More information about the web-devel mailing list