scalaz Questions

1

Solved

On SO an explanation is given why a Validation like in scalaz, cats (Scala), or Arrow (Kotlin) can't be a monad. As far as I understand it's because they've modelled monads in terms of applicativ...
Baskerville asked 4/5, 2018 at 11:54

1

Solved

I'm learning functional programming and have some (maybe obvious, but not for me :) ) question about monad. Every monad is an applicative functor. Applicative functor in turn can be defined as a hi...
Coauthor asked 5/3, 2018 at 21:41

1

I was wondering if anyone could provide some insight on a problem I'm having. I've made a gist with some code and explanation of my problem: https://gist.github.com/tbrown1979/9993f07c8f4fa2786c83 ...
Month asked 23/6, 2015 at 17:42

2

Solved

Problem statement: I read in multiple sources/articles that implicits drive up scala compilation time I want to remove/reduce them to minimum possible to see what compilation time without them wi...
Celeriac asked 1/1, 2018 at 23:51

1

Solved

I want to use Cats EitherT and OptionT to handle the type Future[Either[Error, Option[T]]. Suppose the following methods: def findTeacher(id: Int): Future[Either[String, Option[Teacher]]] def find...
Springbok asked 28/12, 2017 at 16:18

2

I am wondering if there is a typeclass in Cats or Scalaz which offers an operator like this: def scan[G[_],A,B](zero: B)(g: G[A],f: (A,B) => B):G[B] Or if there exists some mathematical defi...
Picador asked 20/12, 2017 at 17:28

2

Solved

There's a great tutorial here that seems to suggest to me that the Writer Monad is basically a special case tuple object that does operations on behalf of (A,B). The writer accumulates values on th...
Allies asked 29/5, 2014 at 20:58

3

Solved

I want to call Scalaz's pure method to put a value into the State monad. The following works: type IntState[A] = State[Int, A] val a = "a".pure[IntState] a(1) (Int, java.lang.String) = (1,a) I ...
Bucovina asked 4/10, 2011 at 5:0

2

Solved

I have a class Foo with two parameters, and I am trying to write a Functor instance for Foo with the first parameter fixed, as follows: object Scratchpad { trait Functor[F[_]] { def fmap[A, B](...
Weisbrodt asked 24/7, 2017 at 2:50

2

did anybody come to piece of code how to properly convert scala's Future (2.10) to new scalaz7 future ? I know hot to convert scalaz future via scala Promise to scala Future, but not sure how to do...
Dardar asked 3/6, 2013 at 11:25

1

Solved

In Integrating State with Either (slide 88), given the pattern of State layered under Either, is there a recommended approach for adding another type of state, e.g., logging via something like Writ...
Pavis asked 8/1, 2017 at 18:9

1

Solved

I am newbie at using Shapeless, and I am experimenting with Shapeless for automatic type class generation and folding over HLists. My goal is to render a HList as (a, b, c, d) using a typeclass im...
Incubation asked 29/4, 2017 at 0:2

5

I would like to use Scalaz for validations and like to be able to reuse the validation functions in different contexts. I'm totally new to Scalaz btw. Let's say I have these simple checks: def ch...
Yearwood asked 24/2, 2012 at 9:17

1

Solved

I was looking for a data type for asynchronous operations. I found that scalaz.ContT[Trampoline, Unit, ?] supports all features in scalaz.concurrent.Future, in addition of BindRec. Though, there ...
Antisemite asked 31/3, 2017 at 14:27

6

Solved

I'd like to combine two Lists of arbitrary length in such a way that elements from the 2nd List are inserted after every n-th element into the 1st List. If the 1st List length is less than n, no in...
Siberson asked 5/7, 2012 at 18:27

2

Solved

When browsing a piece of Scala code at aws-scala by Atlassian you can find the following line: type QueueURL = String @@ QueueURL.Marker I am new to Scala, so I might be wrong, but the @@ (doubl...
Averil asked 22/2, 2017 at 15:58

2

Solved

Here's a simple finch server, using circe as decoder: import com.twitter.finagle.http.RequestBuilder import com.twitter.io.Buf import io.circe.generic.auto._ import io.finch._ import io.finch.circ...
Eyebrow asked 13/2, 2017 at 16:45

1

Solved

All of my API methods return Future[Option[T]], trying to figure out how to elegantly perform the following: case class UserProfile(user: User, location: Location, addresses: Address) The below ...
Logarithm asked 10/2, 2017 at 0:17

1

In this question from 2013, Mr. Odersky notes that "it's too early to tell" whether libraries like Scalaz will be able to exist (at least in their current state) under Dotty, due to the castration ...
Ferrand asked 7/12, 2016 at 2:15

2

Solved

I had previously thought that part of the goal of the implementation was to avoid this very problem, so maybe I'm doing something obviously dumb? Here is some code: // Stack overflow import scal...
Culpa asked 15/4, 2015 at 20:17

1

Solved

Suppose that I'm trying to implement a very simple domain specific language with only one operation: printLine(line) Then I want to write a program that takes an integer n as input, prints somet...
Amphipod asked 13/12, 2016 at 14:1

2

Solved

I need to generate the combinations for a list of 30,000 items using scalas combinations method on a stream / list 1 to 30000.toStream.combinations(2).size This function never completes. When ...
Theodore asked 15/11, 2016 at 15:43

5

Solved

Is there a functional/Scala way to call a function repeatedly until it succeeds, while reacting to failed attempts? Let me illustrate with an example. Suppose I want to read an integer from standa...
Quenna asked 13/2, 2015 at 18:41

6

Solved

I have a List[Option[Int]] and want to sum over it using applicative functors. From [1] I understand that it should be something like the following import scalaz._ import Scalaz._ List(1,2,3).map...
Chutney asked 16/11, 2011 at 5:11

3

Solved

Using scalaz-stream is it possible to split/fork and then rejoin a stream? As an example, let's say I have the following function val streamOfNumbers : Process[Task,Int] = Process.emitAll(1 to ...
Triangulate asked 17/12, 2014 at 9:35

© 2022 - 2024 — McMap. All rights reserved.