Pointed [Re: 2014 Applicative => Monad proposal]
Casey McCann
cam at uptoisomorphism.net
Fri May 24 20:13:34 CEST 2013
On Fri, May 24, 2013 at 1:56 PM, Edward A Kmett <ekmett at gmail.com> wrote:
> This is precisely the situation I am referring to when I mention ad hoc casewise reasoning.
>
> What laws say that 'foldMap point' does anything useful? Given just the type signature what reasoning can you do?
>
> Without knowing the particular instances involved, you get nothing.
>
> With Set you get a glued together Set, but Maybe is going to try to smash together the elements under the Maybe with some extra Semigr^H^H^H^H^H^HMonoid.
>
> Pointed requires ad hoc reasoning for virtually every use case. The only law you can state for it is a free theorem for its type.
It's sort of like a higher-kinded equivalent of Data.Default, with
roughly the same semantics. Just think of it as being like
QuickCheck's Arbitrary class, except with a single, pre-determined RNG
seed. Useful!
> On the other hand with classes like Apply or Bind you get access to lots of useful semigroup-like structures you can still reason about in general, not in particular, including things that can't be made Applicative/Monadic. (e.g. IntMap).
One example is that Bind would occasionally be handy for EDSLs that
don't permit lifting arbitrary values as a no-op. Incidentally,
desugaring do notation does not actually use return at all, if memory
serves me...
- C.
More information about the Libraries
mailing list