scalaz

    1热度

    2回答

    给定一个队列像这样: val queue: Queue[Int] = async.boundedQueue[Int](1000) 欲拉断该队列和它传输到下游水槽,在UP的组块100。 queue.dequeue.chunk(100).to(downstreamConsumer) 作品之类的,但如果我有说101个的消息就不会清空队列。剩下1条消息,除非另有99个消息被推入。我希望尽可能多地从

    1热度

    1回答

    对于下面的假设函数(在scala中),函数式编程中适当的返回类型是什么? def execute(req: HttpRequest): <UnknownResultType> 我会假设IO[Future[Response]],因为我们既有的网络副作用,以及异步。 由于这可能有点麻烦(monad包裹在monad中,即使使用monad变换器),FP中是否有更好的抽象来处理这个问题?

    4热度

    1回答

    我还没有在Scalaz github repo中找到任何对xml模块的引用。在分支series/7.1.x它是但不在latest。另外,没有关于Scalaz的xml处理的文档(这很奇怪)。任何想法为什么? 据我所知,大XML处理没有真正的选择。 Anti-xml被放弃了(虽然有no.arktekk的更新版本),scala-xml有性能问题。 你会推荐我任何值得一试的项目吗?我知道ScalesXml

    1热度

    1回答

    综观写得很好的学习Scalaz,我看着Enum的: scala> 'a' |-> 'e' res20: List[Char] = List(a, b, c, d, e) 我可以得到它的头: scala> res20(0) res21: Char = a 而且然后得到其继任者: scala> res20(0).succ res22: Char = b 但是,为什么是头部的pred等

    1热度

    1回答

    为什么斯卡拉斯的Applicative.scala有point方法? trait Applicative[F[_]] extends Apply[F] { self => //// def point[A](a: => A): F[A] // alias for point final def pure[A](a: => A): F[A] = point(

    1热度

    1回答

    我有以下功能: def map2[F[_]: Monad, A,B,C](fa: F[A], fb: F[B])(f: (A,B) => C): F[C] = for { v1 <- fa v2 <- fb } yield f(v1,v2) def sequence[M[_]: Monad, A](lma: List[M[A]]): M[List[A]]

    3热度

    1回答

    我在以下示例代码中有两个函数:runF和run。 import scalaz._, Scalaz._ import scala.concurrent.Future sealed class Controller[TState] { def genStartState(): TState = ??? implicit val m = Monoid.instance[Boo

    1热度

    1回答

    我与Scalaz验证工作的清单,我碰到这样的情况下(注意,这在很大程度上从我的实际代码的简化,但这个想法是一样的) 考虑: case class Foo(bar: Int) val x1: Validation[String, Foo] = Foo(1).success val x2: Validation[String, Foo] = Foo(2).success val x3: Val

    2热度

    1回答

    鉴于以下Person SQL和型号代码: SQL CREATE TYPE sex AS ENUM ('male', 'female'); CREATE TABLE person ( id bigserial primary key, name varchar(100) NOT NULL, age integer NOT NULL, gender sex N

    2热度

    1回答

    给定一个更高的Kinded类型M和monad类型的类,我可以通过for-understanding理解M内的值。使用返回Options的函数,即时寻找一种更合适的方式来扁平化这些选项,而不是我的解决方案。这是如下 class Test[M[+_]:Monad](calc:Calculator[M]) { import Monad._ def doSomething(x:Flo