data-default WAS: [containers] Proposal: Change to the Data.Map Monoid
Roman Cheplyaka
roma at ro-che.info
Thu May 22 07:50:51 UTC 2014
* João Cristóvão <jmacristovao at gmail.com> [2014-05-22 08:35:43+0100]
> The case is that for very long and complex structures, filled with trivial
> values, and with an obvious default value, writing that default value is a
> task best left for the compiler, with the help of generics.
I do see value here.
My biggest problem with the package is that the basic types like Int have
defaults.
While it clearly makes sense to define ParseOptions or ConnectInfo as an
instance of Default, I don't see who has the authority to declare defaults for
Int.
Especially combined with generic deriving, this can lead to hard-to-detect bugs.
And to achieve the desired behavior you need to newtype-wrap those Ints half of
the time anyway.
OTOH, I'd say defaults for [], Data.Map etc. are *probably* fine.
Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140522/6a2404b2/attachment.sig>
More information about the Libraries
mailing list