scalaz Questions
2
Solved
tl;dr: How do I do something like the made up code below:
def notFunctor[M[_] : Not[Functor]](m: M[_]) = s"$m is not a functor"
The 'Not[Functor]', being the made up part here.
I want it to su...
Stanzel asked 12/4, 2013 at 3:51
4
Solved
I know that I can use
import zio.Task
def zip3Par[A, B, C](a: Task[A], b: Task[B], c: Task[C]): Task[(A, B, C)] =
a.zipPar(b).zipWithPar(c) { case ((a, b), c) => (a, b, c) }
def zip4Par[A, B...
3
Solved
What is the idiomatic way of applying a function A => Try[B] on a List[A] and return either the first succesful result Some[B] (it short-circuits) or if everything fails, returns None
I want to...
Checkered asked 6/11, 2014 at 21:28
3
Solved
When asked about Dependency Injection in Scala, quite a lot of answers point to the using the Reader Monad, either the one from Scalaz or just rolling your own. There are a number of very clear art...
Spurt asked 20/3, 2015 at 19:34
4
Solved
For a monad M, Is it possible to turn A => M[B] into M[A => B]?
I've tried following the types to no avail, which makes me think it's not possible, but I thought I'd ask anyway. Also, search...
8
Solved
Say I have two maps:
val a = Map(1 -> "one", 2 -> "two", 3 -> "three")
val b = Map(1 -> "un", 2 -> "deux", 3 -> "trois")
I want to merge these maps by key, applying some functi...
Camphene asked 13/10, 2011 at 13:55
1
Solved
If I have an EnumeratorT and a corresponding IterateeT I can run them together:
val en: EnumeratorT[String, Task] = EnumeratorT.enumList(List("a", "b", "c"))
val it: IterateeT[String, Task, Int] =...
Caulis asked 13/11, 2014 at 17:21
2
Solved
Suppose I want to write a method with the following signature:
def parse(input: List[(String, String)]):
ValidationNel[Throwable, List[(Int, Int)]]
For each pair of strings in the input, it nee...
Artifice asked 19/11, 2013 at 7:42
4
Solved
I would like to know how to convert a List[Try[T]] into Try[List[T]] in Scala?
I have tried using an accumulator and folding right but it doesn't seem ideal.
Haletta asked 15/8, 2019 at 21:4
9
Solved
I am trying to issue a simple POST request to a webservice which returns some XML in Scala.
It seems that Dispatch is the standard library used for this task, but I cannot find documentation for i...
2
Solved
I've been looking but I can't find an implicit converter. Obviously it would be trivial to write one but I'm wondering if I've missed one in the scalaz library somehow!
1
I'm trying to understand how to reorganize a program which I would previously have written as a sequence of state transitions:
I have some business logic:
type In = Long
type Count = Int
type Ou...
Fungal asked 17/11, 2014 at 14:33
5
Solved
I want to transform a List[Option[T]] into a Option[List[T]]. The signature type of the function is
def lo2ol[T](lo: List[Option[T]]): Option[List[T]]
The expected behavior is to map a list that...
Prefix asked 2/4, 2010 at 20:28
5
Solved
I want to perform several ordered and successive replaceAll(...,...) on a string in a functional way in scala.
What's the most elegant solution ? Scalaz welcome ! ;)
Sandpit asked 5/7, 2012 at 17:30
5
Solved
Having
(Some(1), Some(2))
I expect to get
Some((1, 2))
and having
(Some(1), None)
I expect to get
None
6
Solved
I want to be able to apply an operation f: (T,T) => T to Option[T] values in Scala. I want the result to be None if any of the two values is None.
More specifically, I want to know if there is ...
Poison asked 26/4, 2010 at 9:42
3
Solved
I have a List of Map[Int, Int], that all have the same keys (from 1 to 20) and I'd like to merge their contents into a single Map[Int, Int].
I've read another post on stack overflow about merging...
Atencio asked 27/2, 2013 at 19:10
3
Solved
For any given String, for instance
val s = "abde"
how to insert a character c: Char at position 2, after b ?
Update
Which Scala collection to consider for multiple efficient insertions and de...
Barbirolli asked 11/8, 2014 at 7:9
8
Solved
Given a sequence of eithers Seq[Either[String,A]] with Left being an error message. I want to obtain an Either[String,Seq[A]] where I get a Right (which will be a Seq[A]), if all elements of the se...
Hijacker asked 29/8, 2011 at 13:47
3
Solved
What is Comonad, if it's possible describe in Scala syntax.
I found scalaz library implementation, but it's not clear where it can be useful.
2
Is there a way to find out the memory/size occupied by an object in scala?
Thanks in advance for replying me.
Sharma asked 2/1, 2018 at 16:37
2
How does the Cats library relate to scalaz? The Cats project mentions it is descended from scalaz.
Gainor asked 25/4, 2015 at 20:26
2
In scalaz when we define a module, we additionally define implicit, helper functions. Here is an example of definition and how it could be used by a client:
trait Functor[F[_]] {
def map[A,B](fa:...
Vinaigrette asked 11/6, 2018 at 7:6
1
Solved
I'm trying to understand Lenses in scalaz (surprisingly didn't find something similar in cats-core) and I came across the so called Store which is a type alias:
type StoreT[F[_], A, B] = IndexedSt...
Leg asked 16/6, 2018 at 12:49
2
Solved
I'd like to know what should be the signature of my methods so that I handle different kind of failures elegantly.
This question is somehow the summary of many questions I already had about error ...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.