Pointed sucks

151 views
Skip to first unread message

Tony Morris

unread,
Jul 23, 2012, 9:39:41 PM7/23/12
to sca...@googlegroups.com
Hello,
I am often asked what a good way to get started with Scalaz would be. It
turns out, there is no good way and that the idea of a "good way to get
started" doesn't really make sense in the context of the Scalaz library,
so some people are disappointed when I do not give a clear answer.

Although there is still not a good answer, I can at least articulate a
task that can possibly help.

The Pointed type-class is a mistake. It should not exist on its own. It
belongs on Applicative. The point operation should look like this:

trait Applicative[F[_]] extends Apply[F] {
def point[A](a: => A): F[A]
}

I spent about 30 minutes initiating this change, without the intention
of completing it, but I just wanted to see what would be involved. I
learned that a lot of thinking and learning would be involved.
Nevertheless, I think fixing this bug is quite important. So if anyone
is up to it, there would be free cookies involved.

--
Tony Morris
http://tmorris.net/


Runar Bjarnason

unread,
Jul 23, 2012, 9:41:59 PM7/23/12
to sca...@googlegroups.com
I agree that Pointed is not really meaningful without Apply.

But, out of curiosity, why is this important?
> --
> You received this message because you are subscribed to the Google Groups "scalaz" group.
> To post to this group, send email to sca...@googlegroups.com.
> To unsubscribe from this group, send email to scalaz+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/scalaz?hl=en.
>

Tony Morris

unread,
Jul 23, 2012, 9:49:53 PM7/23/12
to sca...@googlegroups.com
I guess it is less important than the extent to which it annoys me. The
invitation provided by its existence is a trap that I have fallen into
and I do not want others to do same.

I may be overstating its importance.

Chris Marshall

unread,
Jul 24, 2012, 4:05:52 AM7/24/12
to sca...@googlegroups.com
Not quite relevant to pointed; but a good way to start with scalaz is taking the monoid route in my opinion. Monoids are refreshingly simple and their utility can be made plain with some obviously relevant examples.

Chris

James Moore

unread,
Jul 24, 2012, 12:08:18 PM7/24/12
to sca...@googlegroups.com
On Mon, Jul 23, 2012 at 6:41 PM, Runar Bjarnason <runar...@gmail.com> wrote:
> I agree that Pointed is not really meaningful without Apply.

A comment about that in Pointed.scala might be helpful for newbies like me.

--
James Moore
ja...@restphone.com
http://blog.restphone.com/
http://www.linkedin.com/in/jamesmmooreiv

Matthew Pocock

unread,
Jul 24, 2012, 7:49:28 PM7/24/12
to sca...@googlegroups.com
On 24 July 2012 02:41, Runar Bjarnason <runar...@gmail.com> wrote:
I agree that Pointed is not really meaningful without Apply.


I don't think I understand. I thought that Pointed was a type that you can lift single values into. Is there more to it than that? I could lift values into something with a Plus instance defined but which has no Apply instance. Would that be an abuse of Pointed?

Matthew



--
Dr Matthew Pocock
Integrative Bioinformatics Group, School of Computing Science, Newcastle University
skype: matthew.pocock
tel: (0191) 2566550

Tony Morris

unread,
Jul 24, 2012, 9:20:52 PM7/24/12
to sca...@googlegroups.com
On 25/07/12 09:49, Matthew Pocock wrote:


On 24 July 2012 02:41, Runar Bjarnason <runar...@gmail.com> wrote:
I agree that Pointed is not really meaningful without Apply.


I don't think I understand. I thought that Pointed was a type that you can lift single values into. Is there more to it than that? I could lift values into something with a Plus instance defined but which has no Apply instance. Would that be an abuse of Pointed?

I can understand how you might think it is not an abuse because I have fallen into this trap myself. I think we (at least I) are coming to terms with the fact that yes it is an abuse and I suspect there are practical implications (which I have yet to accurately articulate).

The problem, in summary, is that point+fmap is lawless, except for laws which are given by parametricity anyway. However, ap+point gives rise to useful laws. I am aware that there are others out there who have stronger objections to this lawlessness than I do, but I have come to accept that it is inappropriate. If I can articulate a concrete example of why, then I will, but I cannot think of a satisfactory concrete explanation at the moment.

I guess I just don't want to be classy http://hackage.haskell.org/packages/archive/classy-prelude/0.1.0.0/doc/html/ClassyPrelude-Classes.html
Reply all
Reply to author
Forward
0 new messages