Proposal: Functor and friends for the wrappers in Data.Monoid

Roman Cheplyaka roma at ro-che.info
Sat Feb 21 19:37:49 UTC 2015


Has anyone considered the increased object files size as a downside?

On 21/02/15 20:51, Oleg Grenrus wrote:
> As Sean pointed out there is already a thread about this issue.
> I agree with Erik’s opinion, https://mail.haskell.org/pipermail/libraries/2014-December/024509.html :
> 
>> I'm +1 on the obviously useful instances (Data, Functor) and wouldn’t mind the others either, since I don't see any downsides.
> 
> Simple use case for Functor is e.g. fromIntegral <$> s
> 
>> 
> Sean, is there a trac ticket for this issue? I could make a patch early next week, as this seems to be discussed previously.
> 
> - Oleg
> 
>> On 21 Feb 2015, at 20:21, Joachim Breitner <mail at joachim-breitner.de> wrote:
>>
>> Hi,
>>
>> Am Samstag, den 21.02.2015, 17:34 +0200 schrieb Oleg Grenrus:
>>> I propose to add Functor, Applicative, Monad, Foldable, and
>>> Traversable and maybe even MonadFix instances to wrapper newtypes in
>>> the Data.Monoid module.
>>
>> can you explain when these are useful?
>>
>> Especially, the Monad instance might be rather confusing: When I see
>> "Monad Sum", I might somehow expect that >>= would somehow, well, sum
>> things up. But
>>
>>  foo = getSum $ do
>>     return 1
>>     return 2
>>     return 3
>>     return 4
>>
>> does not return 10
>>
>> (At least you are not proposing a MonadPlus instance; that would be then
>> really confusing.)
>>
>> Greetings,
>> Joachim


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150221/b2572d56/attachment.sig>


More information about the Libraries mailing list