Deprecate First and Last in Data.Monoid

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Thu Apr 12 00:17:29 UTC 2018


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


More information about the Libraries mailing list