All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gopher.monads.ReadChannelCpsMonad.scala Maven / Gradle / Ivy

Go to download

scala-gopher: asynchronous implementation of CSP ( go-like channels/selectors ) in scala

The newest version!
package gopher.monads

import gopher._
import cps._

import gopher.impl._

given ReadChannelCpsMonad[F[_]](using Gopher[F]): CpsMonad[ [A] =>> ReadChannel[F,A]] with

  def pure[T](t:T): ReadChannel[F,T] = 
     ReadChannel.fromValues[F,T](t)

  def map[A,B](fa: ReadChannel[F,A])(f: A=>B): ReadChannel[F,B] =
     fa.map(f)

  def flatMap[A,B](fa: ReadChannel[F,A])(f: A=>ReadChannel[F,B]): ReadChannel[F,B] =
    new ChFlatMappedReadChannel[F,A,B](fa,f)   





© 2015 - 2025 Weber Informatics LLC | Privacy Policy