[Haskell-cafe] Re: Should Yesod.Mail be a separate package?

Yitzchak Gale gale at sefer.org
Thu Oct 21 08:47:38 EDT 2010

I wrote:
>> 2. mailHeaders should have an Ord instance that
>> compares case-insensitively, though the underlying
>> Strings should remain Strings.

I really meant Eq instance - which then affects the Ord
instance, too. Sorry.

wren ng thornton wrote:
> What is the intended use case? Since many uses of Ord imply filtering out
> duplicates, this seems like it could result in getting inconsistent
> capitalization. Granted, the RFC says it's case-insensitive, but some folks
> like their aesthetics... (then again, those folks should probably use
> case-normalizers. I'm mostly just curious if the Ord is intended for
> Data.Map or what.)

Of course the type will preserve case internally. I envision
something like a HeaderName type which is a newtype
wrapper for String. If you really want to see the details of
case when you are doing something other than rendering,
you can always extract the String out of the newtype.
But semantically, header names are case insensitive.

Here is a use case - I want to search for the "From" field
in an email. (Or all of the "From" fields, sometimes there
is more than one.) Well, someone may have used non-standard
case, but it should still match.


More information about the Haskell-Cafe mailing list