Questions tagged [scalaz7]

Scalaz provides type classes and purely functional data structures for Scala

102 questions
4
votes
1 answer

How to fix sbt's [warn] Skipped generating '' for dependency?

When I run makePom in sbt I get: [warn] Skipped generating '' for org.scalaz#*. Dependency exclusion should have both 'org' and 'module' to comply with Maven POM's schema. [warn] Skipped generating '' for com.jolbox#*.…
Robin Green
  • 32,079
  • 16
  • 104
  • 187
4
votes
1 answer

Why does this Scalaz 7 enumerator leak memory?

The following definition results in a memory leak: def enumIterator1[E, F[_]: Monad](x: => Iterator[E]) : EnumeratorT[E, F] = new EnumeratorT[E, F] { def apply[A] = (s: StepT[E, F, A]) => { def go(xs: Iterator[E]): IterateeT[E, F, A] = …
Aaron Novstrup
  • 20,967
  • 7
  • 70
  • 108
4
votes
2 answers

How to help Scalaz with type inference and 2 type parameters

I have something called a Generator: trait Generator[A, B] { def generate(in: Seq[A]): Seq[B] } I can provide a Bind instance for this generator: object Generator { implicit def generatorBind[T]: Bind[({type l[B] = Generator[T, B]})#l] = new…
Eric
  • 15,494
  • 38
  • 61
3
votes
1 answer

Scalaz Reader to ReaderT

A function which I cannot change returns Scalaz Reader, type Action[A] = Reader[Session, A] def findAccount(s: String): Action[Account] = Reader((session: Session) => Account(s)) I want create a new function based on findAccount(...) to return…
thlim
  • 2,908
  • 3
  • 34
  • 57
3
votes
1 answer

Are unboxed tagged types safe?

I've recently heard about unboxed tagged types in scala and while I was trying to learn how exactly it works, I've found this question that points to problems the implementation in scalaz had. One of the consequences of the fix was having to…
andrepnh
  • 933
  • 8
  • 21
3
votes
3 answers

What's the new name for map2 in Scalaz 7?

Jordan West in this presentation from Scalamachine clearly speaks about map2 function. Turns out the function was available in Scalaz 6 but I can't find it or any equivalent in Scalaz 7. E.g. I would like to be able to run this code: List(Some(1),…
mjaskowski
  • 1,479
  • 1
  • 12
  • 16
3
votes
1 answer

What does λ[α =>F] mean?

I'm learning Scalaz recently. I would like to know how λ[α =>F] works? scala> Applicative[λ[α => Int]].point(10) res45: Int = 0 scala> Applicative[λ[α => String]].point(10) res46: String = "" I can understand λ means some type here, but I could…
Binzi Cao
  • 1,075
  • 5
  • 14
3
votes
2 answers

How to implement parametric lenses that change type of state

So in scala we have the typical Lens signature as: case class Lens[O,V](get: O => V, set: (O,V) => O) But as you can see, it only updates and sets values of the same type, it does not set one type for another. What I have in mind is something more…
user1553111
3
votes
1 answer

How do I declare a scala case class to be an instance of Scalaz's Semigroup?

I have a type, defined as follows: import scalaz._, Scalaz._ case class MyInt(i : Int) I want to make an instance of Semigroup. I tried this: object MyInt { implicit def myIntSemigroup: Semigroup[MyInt] = new Semigroup[MyInt] { …
Mersenne Prime
  • 565
  • 1
  • 4
  • 5
3
votes
0 answers

Parsing Big XML with Scales Xml (Scala), the functional way - StackOverFlowError using Zippers

Long time lurker, first time poster. Please let me know if my question is not clear. I have a kinda strange XML file that needs to be parsed (put data inside a class and handle it internally). I mention it's strange because what anyone would…
mmedina
  • 256
  • 3
  • 9
3
votes
1 answer

Cohesive way to validate a class in Scala using Scalaz 7

My goal is to validate User's fields within the object's applymethod before creating one effective User instance: case class User(String userName, String password) object User { def apply(userValidator: UserValidator):…
Mik378
  • 21,881
  • 15
  • 82
  • 180
3
votes
2 answers

Best way to write Scala methods signature dealing with exceptions

In order to handle exceptions in Scala, I prefer avoiding basic try/catch and benefit from functional thinking with Validation from Scalaz (similar to Either type in certain cases). My application exposes some services. Imagine this method (making…
Mik378
  • 21,881
  • 15
  • 82
  • 180
3
votes
1 answer

point reader monad scala

is there a way, how to easily point a value in Reader context? I can use Reader object and ignore the context:Reader { _ ⇒ 3 } Scalaz seems to have a method point for this specifically. I see, that is defined on Applicative. I suppose, that there…
ryskajakub
  • 6,351
  • 8
  • 45
  • 75
3
votes
1 answer

Where is the type @> in scalaz source code?

I've been reading the source for scalaz's Lenses, which you can find at https://github.com/scalaz/scalaz/blob/scalaz-seven/core/src/main/scala/scalaz/Lens.scala Starting at line 303, there are functions that return values of type @>[A,B]. Is this…
Mark
  • 5,286
  • 5
  • 42
  • 73
2
votes
1 answer

Specifying an execution context for Monad[Future] when using EitherT in Scalaz 7

I've been trying to tidy up some code which uses multiple functions that all return the type Future[Either[String, A]]. These functions don't compose neatly in a for comprehension because of the problem of having to peak inside the Future and then…
justinhj
  • 11,147
  • 11
  • 58
  • 104