non / alleycats

Cats instances and classes which are outlaws, miscreants, and ne'er-do-wells.
Other
62 stars 14 forks source link

Rename Pointed#point to pure? #1

Closed milessabin closed 9 years ago

milessabin commented 9 years ago

Shouldn't this method align with pure in Applicative?

non commented 9 years ago

I was thinking about this.

One the one hand I like the consistency. Maybe the type class itself should even be called Pure?

On the other, pure in the context of Applicative is defined in terms of a particular relationship with ap and map. I'm reluctant to claim that Pointed#point has that meaning. In this sense we could say:

Point is the same as pure if-and-only-if there are corresonding map and ap methods.

What do you think? I'm open to being convinced either way.

milessabin commented 9 years ago

I also wondered about renaming the whole thing to Pure ... that doesn't seem quite so important though.

I guess my main concern is wanting to be able to implement both Applicative and Pointed/Pure with a single pure method rather than having to provide both.

non commented 9 years ago

Ah, I see. OK, I think that is an overriding concern.

One thing we might want to mandate for these ad-hoc type classes (e.g. Empty, EmptyK, Pure) is that when a corresponding strong type class exists (e.g. Monoid, MonoidK, Applicative) that the instances are required to be congruent.

milessabin commented 9 years ago

Yes, strongly agree. I think we should require a strongIsWeak implicit as you've done (ie. applicativeIsPointed, comonadIsCopointed, etc.) ... would that be enough assurance of congruence?

milessabin commented 9 years ago

FTR I would be fine with s/Pointed/Pure/ and s/Copointed/Extract/.

non commented 9 years ago

Fixed in 9061c5ecf0f2d3b7402.