4 ms·
Sometimes you go back and reinvent the stack (breaking everyone's code) and other times you introduce things non-breakingly. > why isn't a Haskell monoid defin
by mrkeen 5mo ago
Sometimes you go back and reinvent the stack (breaking everyone's code) and other times you introduce things non-breakingly.
> why isn't a Haskell monoid defined as an extension of a semigroup
class Semigroup a => Monoid a where
[https://hackage-content.haskell.org/package/base-4.22.0.0/docs/Data-Monoid.html]
> If functors are as basic and fundamental as they seem, why do they get an awkward "fmap" - with most standard types re-exporting it as plain "map"?
map was in the original 1990 Haskell spec [https://www.altocumulus.org/haskell-report-1.0.pdf https://www.altocumulus.org/haskell-report-1.0.pdf]. Functors & fmap came later. I guess they went with a non-breaking feature introduction.
Other times they do a breaking change. Monads didn't used to need to be Applicative Functors. Now they do. [https://wiki.haskell.org/Functor-Applicative-Monad_Proposal https://wiki.haskell.org/Functor-Applicative-Monad_Proposal]
Anyway, it could be worse. You could be working in a language that can't even express the functor/map interface.
- crote 5mo ago> class Semigroup a => Monoid Yes, hence the "at least a few years ago". But perhaps I'm misremembering and confusing it with applicative functors, it has been a few years. > I guess they went with a non-breaking feature introduction. Sure, but functors aren't exactly novel, are they? Although it has contributed a lot to programming language design in general, Haskell didn't exactly invent the concept of a generic "map". So why wasn't it there in the first place, and why was it - despite its obvious prominence - not deemed important enough for a (what seems to be tiny) breaking change? > Anyway, it could be worse. You could be working in a language that can't even express the functor/map interface. Are those still around? I thought even Go eventually started supporting generics?
- mrkeen 5mo ago"Generics" doesn't cut it. Most languages just can't functor. Go - no. https://www.reddit.com/r/golang/comments/v1ljep/monads_and_popular_fp_abstractions_based_on_go/ https://www.reddit.com/r/golang/comments/v1ljep/monads_and_p... Swift - no. https://forums.swift.org/t/higher-kinded-types-monads-functors-etc/4691 https://forums.swift.org/t/higher-kinded-types-monads-functo... Rust - no. https://www.reddit.com/r/rust/comments/152bgj0/current_state_of_functors_fmap_in_rust/ https://www.reddit.com/r/rust/comments/152bgj0/current_state... "Awkward fmap" and "random collection of category theory concepts thrown together in a weekend" is great compared to the alternatives.