Which Applicative do you mean? For the one in scalaz, there is an
implementation for Option.
Do you want a method on Option[T] taking an Option[T => U], returning
Option[U]?
- --
Tony Morris
http://tmorris.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJOPTUYAAoJEPxHMY3rBz0P/AkH+QHw/TSMY0V/xdbiJCE3tDiD
vcp/q3joi28IrbYh1tCDwUmu9Ghkt20nTI28Q6vJAjw9VIgo5B3ZZt7oSP/GH2AW
P3q4+w1/63Kr9+6Tes18iunuXhgvxNYSIko5higoqa8pYIcjqYdcH4J00X6Kmxhm
cr7SsYDcN9E3sW1KLXwITXqc/oafYaKfFRDQgJi0UUItKBrkKsFrW5E1Ur5Oer+1
RKjG8iq1TPhvsfx9VruzRW/EQZIu8Lu7lHcI3gpDD0dAfkdBKSsaatgT6bYyWKM+
z9iknqxylEGDROUridDYNwylgO3NYMDsIXjGCrMYcfZgPM7PBbDaL/f0+u29+OI=
=ZOH6
-----END PGP SIGNATURE-----
Well then that would require such a method on many type constructors,
and the body of these methods would be a copy/paste show.
def <*>[B](f: F[A => B]): F[B] = for { ff <- f; aa <- this } yield ff(aa)
On 06/08/11 22:52, Marius Danciu wrote:
> Precisely.
>
> Marius
>
> On Sat, Aug 6, 2011 at 3:35 PM, Tony Morris <tonym...@gmail.com> wrote:
>
> On 06/08/11 21:27, Marius Danciu wrote:
>>>> Hello,
>>>>
>>>> Is there a good reason why Scala Option is not an applicative functor ? I
>>>> guess one could seamlessly convert an Option[T] to an Applicative[T]
> using
>>>> implicits but still ..
>>>>
>>>> Thanks,
>>>> Marius
>>>>
>
> Which Applicative do you mean? For the one in scalaz, there is an
> implementation for Option.
>
> Do you want a method on Option[T] taking an Option[T => U], returning
> Option[U]?
>
>
>>
- --
Tony Morris
http://tmorris.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJOPTmTAAoJEPxHMY3rBz0PKcwH/iIFD1ObJ9mv3guHeG8ZtA7g
FaihUXwmV+qd/mCUpvNaGp7mj1gpZwJuS2360CsFjoyKaNiA3ilI5n5ZpBNokGiT
ZgMvQb1akKCQuwIjDfmSdbiXltipsEjnh9X6210qwbpOyUip+ocniS+c3WanUvps
Au3VhUe95/cc7cesjl2oOrwdDsvwgel1mJlMnOwxTTikWoV3d7jgi/cIZCmTut9u
uJ9egAiVE4RycQ83omx/95VRyRBM78UvfHdzhzIQSkiT+NLz6qtHRniEku0Qvb7k
U9iiCq0q4m5FIKFA4HGABi09OC/I7OKneQ3uSrlLZHdF5nLJCU53XeaDLxtFaWs=
=cJng
-----END PGP SIGNATURE-----
You could say that about an enormous number of traits.
There is a "growing movement" of people who delay introduction of the
unit operation, so you'd have a trait with ap+fmap instead (semigroups
instead of monoids).
iQEcBAEBAgAGBQJOPTwJAAoJEPxHMY3rBz0PPK0IALCCSVUxZ3Uv37LQhdkA1QJ1
LlkFaJ9dFoSwqoPDe7WxuqxnWTNe12iNc7op5Mw00Ql2bSa8V7sOfVSMaj+oyxeO
Ci+QlO633wjTcsfPbcPugJ6usqN/EM6Dm0rMx/c7eeKxIktzhKT7x+vq4c29H4Ru
lG5SjMscm6teN9MMuCeCcTl1RklymAl6YvETemM1AQW3H1SNmFDpKRUyLAbkj0Vj
HuiDBzDy/4MhLj79zJTFG+/MMAOra0c99QQJ0vJvpRoHZvAhNC8y9MdOpq/h+nH3
M4prjgvG3/PyIeyVJI0p5ZJ66QnyqTJPRH/xORTMkf6hDLZhos0cJq8PMpTAVIw=
=T2dK
-----END PGP SIGNATURE-----
Ever since your earlier email about this I've been interested and
waiting to see what you have. Anything you can share yet? I'd love to
be a sounding board on this, given that it could really aid the work
I'm doing with Numeric.
-- Erik
That'd be great and I'm sure that a lot of folks are looking for this.
If we could just delay the introduction of the point operation... even
Scala has this bias in its for-comprehensions.
There are many useful operations on, say map+flatMap, for which there
are structures that many not be pointed functors. It is then that you
"go sideways" and introduce the point operation.
Regardless of representation, I would suggest the following levels of
abstraction:
* map
* ap+map
* flatMap+map
...
* map+point
* ap+map+point (aka Applicative)
* flatMap+map+point (aka Monad)
I guess I am encouraging this direction because I came up with it myself
after observing that (to summarise) "not all semigroups are monoids",
then I was subsequently convinced by Edward Kmett about this direction
(while hiding the fact that I was already well-persuaded).
- --
Tony Morris
http://tmorris.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJOPcGzAAoJEPxHMY3rBz0PG88H/1TkciGB/w/u8C78QeuNhtWf
GP13VSOPqDP9RCctSfOD6p5daRox+PKlNZj641DpD2dfY3o8S0x+DnDk1oUIVIjQ
8pLIVMP7WWp0s6G5zRLiu1+JDLwk16Ds44q60FOGMEzzCn5sDevc2qfd7xKipTi1
I7uFVmn36thk6VMAFKN9IbnGNpgogN2Wp2JzK/4f7lKaM+Nj4+sXEGu5ItWQXkX6
dAew9c2p2cQnTvgiUUPFyMsOYZtYjq/h/bF7ILmjm/Fk66t02P5QXZ2Ffc6aLoAS
EHLWTRyr5Vcq0vaoKna9OfhqyrVeFVIm8FOzpG9kxy0jSzPNwP0TVE29/adN/vI=
=8AjM
-----END PGP SIGNATURE-----
An applicative functor is a special type of functor. Not all functors
are applicative. Indeed, not all functors are pointed functors (all
applicative functors are pointed functors). There are also plenty of
functors that have F[A => B] => F[A] => F[B] but not necessarily point
(A => F[A]).
iQEcBAEBAgAGBQJOPj8EAAoJEPxHMY3rBz0PUgUH/iuqH7Fm4zC5QnTM40CWXU8m
i88Kek5DDycJYro5caVYxB1Lz3v57ILXlEqWNZDgo7xBf/2EvWvbVgZKC1MY9cq+
RkggKm5XMMaxLzD3B865VF11HoNTB5nT7MWPcpxh5agrSbtLJK3Q1yubOU3H++SO
LycwJDFymfYn22iyvvb1/+xpudN1dSpmyJ5ZgJrReB9aXaR4I9Be9kx8ZmO+Cjxk
rzg/QoMFGvNTa0V0PVQn5J/5V2t79ZnzM30lPaxU5JPKdwlYiPbrUWgCLh3aBMfj
jqAXXHRwE1TcvWLkBdsgwfSGDKbLKlNyGQ+vvC8azQSX5f3n3O/Orr/gHPr/Qpc=
=Kc2K
-----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE-----An applicative functor is a special type of functor. Not all functors
Hash: SHA1
are applicative. Indeed, not all functors are pointed functors (all
applicative functors are pointed functors). There are also plenty of
functors that have F[A => B] => F[A] => F[B] but not necessarily point
(A => F[A]).
In any case, are you interested in developing a small subset(the least controversial) of scalaz to push into scala-incubator. If we start now, we can hopefully gain enough traction.
Sure! Though I never can work out which is most controversial.
iQEcBAEBAgAGBQJOPwZVAAoJEPxHMY3rBz0PE58H/j8i2gAEcXiGHpcb2yDF64EV
yhYoXeLG4o5mLuxRzBJcvL6Quvm2O22edkOD0Bpqy6Y6lX9iAwcEIblcdHKgHzv3
h2yjBeKOD5QxUxH/9whCHOV/inJbYH1dZDL4LwjE3UW9CkjzLwp/Tr4bHCQAKDr5
TJXR72LaR9Nnd0JZ8L8XIDMEaBPi0vLVioCulg3WrrihzViNY6ZUOmh2Q2kcdhA7
HQKKnL6Za0gQYb6OQ2FzvxSSwmvQECXDbsRtp+vE9rQq8nX2swpe/ba1b8p7mS/M
o+1J8rU8e2ZydbV/wCuKDKOuGdh79emPaTj9zsCLml5XabshGAh5d3IvDx+eF6Y=
=vgKQ
-----END PGP SIGNATURE-----
Which package name do you intend to use?
Thanks and bye,
Simon