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

John Millikin jmillikin at gmail.com
Fri Jun 10 20:40:36 CEST 2011

On Fri, Jun 10, 2011 at 07:20, Simon Meier <iridcode at gmail.com> wrote:
> Note that the OverloadedStringLiterals together with the 'IsString'
> instances gives you more than just a nice syntactic abbreviation: the
> defined string literals are also lifted out of their context and
> defined as CAFs. Therefore, you can share the conversion from String
> to <your-type> during the whole run of a program. We exploit that in
> blaze-html to do escaping and UTF-8 encoding only once. Hence, in some
> contexts the IsString instances are necessary.

I'm afraid I don't understand this; could you explain the difference
between these two definitions? Specifically, why would the
OverloadedStrings version be more efficient?

foo :: Name
foo = Name "foo" (Just "urn:bar") Nothing

{-# LANGUAGE OverloadedStrings #-}
foo :: Name
foo = "{urn:bar}foo"

More information about the web-devel mailing list