Deprecate First and Last in Data.Monoid

Andrew Martin andrew.thaddeus at gmail.com
Thu Apr 12 00:35:27 UTC 2018


Yes, I meant to say S.First and S.Last on the right-hand sides. I’m trying to get rid of Option on https://ghc.haskell.org/trac/ghc/ticket/15028. It will likely need to be discussed on the mailing list, but I figured I would just check on the trac first for that one since it’s more clear that Option is no longer useful. 

Sent from my iPhone

> On Apr 11, 2018, at 8:17 PM, Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> wrote:
> 
>> On 12 April 2018 at 09:46, Andrew Martin <andrew.thaddeus at gmail.com> wrote:
>> I propose that the data types First and Last, provided by Data.Monoid, be marked deprecated in GHC 8.6 and removed in GHC 8.10. The Semigroup-Monoid Proposal (SMP) brought about changes that, I will argue, make these data types (1) unneeded and (2) confusing.
>> 
>> Why are they no longer needed? Data.Semigroup provides two identically named data types (First and Last). These have Semigroup instances matches what their names suggest. Additionally, SMP corrects the Monoid instance for Maybe so that it now lifts Semigroup instances instead of Monoid instances. What this means is that, assuming the following imports:
>> 
>>    import qualified Data.Monoid as M
>>    import qualified Data.Semigroup as S
>> 
>> We have the following equivalences:
>> 
>>    M.First a === Maybe (M.First a)
>>    M.Last a === Maybe (M.Last a)
> 
> Do you mean `M.First a === Maybe (S.First a)` (and similarly for Last)?
> 
> I'm +0.5 on this (more because of potential code churn.)
> 
> Since base-4.11 the Maybe instances also use Semigroup rather than
> Monoid; is there a plan to deprecate the Option type as well?
> 
> -- 
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
> http://IvanMiljenovic.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20180411/c28c2ae2/attachment.html>


More information about the Libraries mailing list