default instance for IsString
jwlato at gmail.com
Wed Apr 25 18:48:30 CEST 2012
> From: Yitzchak Gale <gale at sefer.org>
> Erik Hesselink wrote:
>> I don't think IsString should be dismissed so easily.
> I'm just saying I don't want to be forced to use it.
> If others like it, I'm not dismissing it.
>> we have a couple of newtypes over Text that do different kinds of
>> normalization. An IsString instance for these is useful and total.
> True. Perhaps you'd be able to get IsBuiltinString instances
> for those too, using newtype deriving, if only the method
> names of IsBuiltinString are hidden and the class name is
> If that doesn't work, I'm fine with using a quasiquoter for
> those instead. Or even just the usual newtype unwrapping
> and wrapping. And again, if you provide IsString and others
> want to use it, that's fine.
I don't see how it would be possible to use a hidden IsBuiltinString
as you describe without bringing Text into base (or alternatively not
providing Text support). Perhaps unfortunately, I think that makes
this solution a non-starter.
I think a neater solution would be some sort of modular String typing,
as I'm pretty sure somebody else on this list already mentioned.
Perhaps a pragma like "DefaultString Data.Text.Text", which would mean
that string literals would be treated as the provided monomorphic
type, on a per-module basis?
More information about the Glasgow-haskell-users