scalaz Questions
1
Solved
I found that there is no more awakeEvery inside scalaz.stream.Process in modern scalaz-stream. How to run something with period then?
Hypersonic asked 29/9, 2015 at 19:13
1
Solved
These two Scalaz types
scalaz.concurrent.Task[+A]
scalaz.effect.IO[A]
seem very conceptually similar. They both:
Represent a potentially side-effecting computation
Produce a success (A) or fa...
Huneycutt asked 28/8, 2015 at 8:26
1
Solved
Background
I have Map[String,String] of configuration values. I want to extract a series of keys and provide meaningful error messages if any of them are missing. For example:
val a = Map("url"-&...
1
I am trying to make a sink that would write a stream to bucketed files: when a particular condition is reached (time, size of file, etc.) is reached, the current output stream is closed and a new o...
Filagree asked 31/3, 2014 at 22:24
3
Solved
A "lens" and a "partial lens" seem rather similar in name and in concept. How do they differ? In what circumstances do I need to use one or the other?
Tagging Scala and Haskell, but I'd welcome ex...
2
Solved
I have a monad that is very similar to a collection monad. I'm currently trying to implement a monad transformer for it, but I'm failing.
I've looked at the ListT implementation in Scalaz 6 and 7,...
Scarfskin asked 23/8, 2013 at 12:33
1
Solved
My gut tells me that nothing short of macros or complex type gymnastics can solve this question in the general case. Can Shapeless or Scalaz possibly help me here? Here is a specific instantiation ...
0
Say I have the following function:
def getRemoteThingy(id: Id): EitherT[Future, NonEmptyList[Error], Thingy]
Given a List[Id], I can easily easily retrieve a List[Thingy] by using Traverse[List]...
Mythological asked 30/4, 2015 at 14:2
2
Solved
In Scalaz every Monad instance is automatically an instance of Applicative.
implicit val listInstance = new Monad[List] {
def point[A](a: => A) = List(a)
def bind[A, B](fa: List[A])(f: A =&g...
1
Solved
When I looked at scalaz.effect.IO source code, I noticed that it has a method apply with the following signature:
sealed trait IO[A] {
def apply(rw: Tower[IvoryTower]): Trampoline[(Tower[IvoryTow...
1
Solved
In Scalaz
Kleisli[F, A, B] is a wrapper for A => F[B].
ReaderT[F, A, B] -- reader monad transformer -- is just an alias of Kleisli[F, A, B].
Reader[A, B] monad is a specialization of Reader...
Phyto asked 24/3, 2015 at 6:52
2
I have written a parser which transforms a String to a Seq[String] following some rules. This will be used in a library.
I am trying to transform this Seq[String] to a case class. The case class w...
1
Solved
In scalaz Kleisli[M[_], A, B] is a wrapper of A => M[B], which allows composition of such functions. For instance, if M[_] is monad I can compose Kleisli[M, A, B] and Kleisli[M, B, C] with >=...
5
Solved
I have scalaZ available.
I have an (A, B) and a (A => C, B => D), I'd like to get a (C, D) in a simple and readable way.
I feel like there's something I can do with applicatives but I can't...
Trahern asked 18/2, 2015 at 22:13
1
Solved
Since adding:
"org.specs2" %% "specs2" % "2.4.15" % "test" withSources() withJavadoc(),
To my build file I get
[warn] Note: Unresolved dependencies path:
[warn] org.scalaz.stream:scalaz-stream_...
3
Solved
This is a follow-up to my previous question. I wrote a monad (for an exercise) that is actually a function generating random values. However it is not defined as an instance of type class scalaz.Mo...
1
Solved
I have a simple program:
import scalaz._
import stream._
object Play extends App {
val in1 = io.linesR("C:/tmp/as.txt")
val in2 = io.linesR("C:/tmp/bs.txt")
val p = (in1 merge in2) to io.stdO...
Isabeau asked 18/11, 2014 at 16:57
2
Solved
I'm trying to provide extension methods to an existing class Elem in Scala. However, I also want the operations to be available to any M[Elem], as long as a Scalaz Functor for M is in scope. The be...
1
Solved
Assuming we have a type T[A,B], can we express the following type constraint, let's call it HT:
every type satisfying HT must be of form T[P1, P2] :: T[P2, P3] :: T[P3, P4] :: ... :: T[PN-1, PN] ...
1
Solved
Suppose my entire project configuration is this simple build.sbt:
scalaVersion := "2.11.4"
libraryDependencies += "org.scalaz" %% "scalaz-core" % "7.1.0"
And this is my code:
import scalaz.Equ...
Mcquiston asked 3/11, 2014 at 14:46
1
Solved
I am confused about the usage case about traverse, traverseU and traverseM, I searched it in the scalaz website, the simple code example:
def sum(x: Int) = x + 1
List(1,2,3).traverseU(sum)
it...
2
Solved
Is it possible to transform a List[F[G[A]]] into F[G[List[A]]] nicely?
I can do this in Scalaz the following way:
val x: List[Future[Option[Int]]] = ???
val transformed: Future[Option[List[Int]]]...
2
I recently asked Map and reduce/fold over HList of scalaz.Validation and got a great answer as to how to transform a fixed sized tuple of Va[T] (which is an alias for scalaz.Validation[String, T]) ...
Airs asked 21/10, 2014 at 13:3
1
Solved
I want to merge two lists:
import scalaz.syntax.align._
import scalaz.std.list._
import scalaz.std.anyVal._
List(1, 2, 3).merge(List(4, 5, 6, 7)) // Evaluates to List(5, 7, 9, 7)
This uses the ...
2
Solved
If I want to generate compile time error when calling .get on any Option value, how to go about doing this?
Haven't written any custom macros but guess it's about time for it? Any pointers?
© 2022 - 2024 — McMap. All rights reserved.