Questions tagged [scalaz]

Scalaz provides type classes and purely functional data structures for Scala

Scalaz is a Scala library for functional programming.

It provides purely functional data structures to complement those from the Scala standard library. It defines a set of foundational type classes (e.g. Functor, Applicative, Monad) and corresponding instances for a large number of data structures.

More information is available on the Scalaz Project page

It is released under the BSD (open source) license.

1048 questions
0
votes
1 answer

Scalaz Map[String, Int] "summation" and foldLeft not working

I have the following function using the scalaz |+| operator: def sumGames(games: List[Map[String, Int]]) = games.foldLeft(_ |+| _) Adding two maps manually works flawlessly (a: Map[String, Int) |+| b: Map[String, Int]), but declaring the…
Dark
  • 803
  • 2
  • 8
  • 23
0
votes
2 answers

Why Bind.ap is implemented by Bind.bind in Scalaz 7

I'm studying Scalaz 7, the type class system is so abstract, and one thing I can not understand is that why Bind.ap is implemented by bind in such a way. trait Apply[F[_]] extends Functor[F] { self => def ap[A,B](fa: => F[A])(f: => F[A => B]):…
smilingleo
  • 121
  • 4
0
votes
0 answers

How to correctly add "scalaz-core_2.10-7.0.0.jar" to scala project

When I add "scalaz-core_2.10-7.0.0.jar" lib to build path my scala project following error appears:
SBotirov
  • 13,872
  • 7
  • 59
  • 81
0
votes
0 answers

Scala compiler error when using Scalaz7 and Json4s

I'm running into a compiler problem when using Scala7-M9 and json4s 3.0.1 with compiler versions 2.10.0 and 2.10.1 When compiling the short snippet of JSON parsing code, I get the following compiler error: [error] JSON.scala:25: erroneous or…
JMac
  • 549
  • 1
  • 6
  • 16
0
votes
1 answer

underscore in expression

What does the underscore mean in below snipped. This is fragment of scalaz7 library: trait Apply[F[_]] extends Functor[F] { self => //... def ap[A, B](fa: => F[A])(f: => F[A => B]): F[B] //... def apF[A, B](f: => F[A => B]): F[A] => F[B] =…
pawel.panasewicz
  • 1,831
  • 16
  • 27
0
votes
1 answer

scalaz Zero defined in base class

I'm just getting started with Scalaz. I'm trying to define a Zero for my type in its superclass. class Base { implicit def BaseZ: Zero[this.type] = zero(classOf[this.type].newInstance() ) } class Child extends Base ~Option(null:Child) //trying…
scalapeno
  • 833
  • 1
  • 6
  • 13
0
votes
1 answer

Updating a scala case class

Possible Duplicate: Update operations on a Scala Case Class This question came to me this evening. I have two instantiated case classes of the same type. case class Foo(a : Option[String], b : Option[String], c : Option[String]) Lets call the…
Rasputin Jones
  • 1,427
  • 2
  • 16
  • 24
0
votes
1 answer

Scalaz and the REPL

I've successfully added scalaz to scala repl (2.9.1) and tried some basic examples with no problem, like : List(10, 20, 30) <*> (List(1, 2, 3) map ((_: Int) * (_: Int)).curried) or List(10, 20, 30) |@| List(1, 2, 3) apply (_ * _) However, the alias…
M'λ'
  • 651
  • 9
  • 21
-1
votes
1 answer

Dependency injection into scala objects (not classes)

I have an import "import play.api.libs.ws.WSClient" which i want to use within my object Object X { ... } But this doesn't seem to be available inside my object. I see that dependency injection is only available for classes. How do i get this to…
user461112
  • 3,811
  • 3
  • 20
  • 25
-1
votes
1 answer

scalaz trying to use Heap , how to override fold function

I have a case class: case class Item(id: Long, rank: Int) and i want to create a heap of Item objects. I try to create an instance of Heap[Item] but i have to override a fold function, i do not know exactly what to do and therefore i am stuck at…
user3224454
  • 194
  • 2
  • 16
-1
votes
1 answer

Implement Future.sequence for case class CanBuildFrom Traversable Iterator Sequence Monad

I have this: case class Sides[A](east: A, west: A) I want to convert this Sides[Future[Boolean]] into this Future[Sides[Boolean]] using Future.sequence how? This is the docs: def sequence[A, M[X] <: TraversableOnce[X]](in: M[Future[A]])(implicit…
user3995789
  • 3,452
  • 1
  • 19
  • 35
-1
votes
1 answer

Constructing Implementation of scalaz.Equal[Foo]

Given the following class: scala> class Foo(x: Int) { def getX = x } defined class Foo I created an implicit Equal[Foo] to be able to use ===. scala> implicit val FooEq: Equal[Foo] = Equal.equal(_.getX == _.getX) FooEq: scalaz.Equal[Foo] =…
Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384
-1
votes
1 answer

AndroidProguardScala and Scalaz

Maybe I'm trying to go pure function functional, but I'm finding that adding scalaz 2.11-7.1.1 to my android application on scala 2.11 causes compile time errors. At first, when I building the project, everything is compiled successfully. When I…
DetriusXii
  • 37
  • 7
1 2 3
69
70