This page is no longer maintained — Please continue to the home page at www.scala-lang.org

scalaz applicative

1 reply
Robert Wills
Joined: 2009-03-04,
User offline. Last seen 32 weeks 4 days ago.

Hello,

I've become quite fond of applicative functors in Haskell, so I was
trying to figure out how they can be used in Scala.

I came across the applicative module in scalaz, and I found some
examples of its use at:
http://scalaz.googlecode.com/svn/artifacts/latest/demo/scalazdemo/contro...

However, these examples don't work with the latest version of scalaz.
In particular, syntactic sugar operators like <*> seem to have been
dropped. I've been trying to figure out how to use it without the
sugar, but I confess that so far I haven't succeeded (guess I don't
really understand applicative functors).

Can anyone tell me how I might try to express something like

some(7) <*> (some(8) > add2)

using the latest version of scalaz?

Many thanks,
Rob

Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.
scalaz applicative
Hi Robert,

We are working on a port of Scalaz to Scala 2.8, but we have a few outstanding compiler bugs blocking us [1].

The operators haven't been removed, many are defined on the trait MA[M[_], A]  [2], to which suitable types are implicitly converted by functions in Scalaz [3].

Nick Partridge has some samples of using these operators on the Validation type [4], although github appears to be down right now.

-jason

[1] http://code.google.com/p/scalaz/wiki/Scala28Port?ts=1257779534&updated=Scala28Port
[2] http://code.google.com/p/scalaz/source/browse/branches/scala-2.8-modular/core/src/main/scala/scalaz/MA.scala
[3] http://code.google.com/p/scalaz/source/browse/branches/scala-2.8-modular/core/src/main/scala/scalaz/Scalaz.scala
[4] http://github.com/nkpart/scalaz-playground/blob/master/src/test/scala/validation.scala


From: Robert Wills <wrwills@...>
Subject: scalaz applicative
Newsgroups: gmane.comp.lang.scala.user
Date: 2009-11-09 12:43:21 GMT (1 hour and 21 minutes ago)
Hello,

I've become quite fond of applicative functors in Haskell, so I was
trying to figure out how they can be used in Scala.

I came across the applicative module in scalaz, and I found some
examples of its use at:
http://scalaz.googlecode.com/svn/artifacts/latest/demo/scalazdemo/control/Applicative.scala

However, these examples don't work with the latest version of scalaz.
In particular, syntactic sugar operators like <*> seem to have been
dropped. I've been trying to figure out how to use it without the
sugar, but I confess that so far I haven't succeeded (guess I don't
really understand applicative functors).

Can anyone tell me how I might try to express something like

some(7) <*> (some(8) > add2)

using the latest version of scalaz?

Many thanks,
Rob

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland