Created
October 27, 2020 16:06
-
-
Save MateuszKubuszok/712aafafb5d37b8aa66bbd2cfc697a60 to your computer and use it in GitHub Desktop.
List of Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait FList[F[_]] extends Product with Serializable | |
object FList { | |
final case class Last[F[_], A, B](f: A => F[B]) extends FList[F] | |
final case class Cons[F[_], A, B, Tail <: FList[F]](f: A => F[B], tail: Tail) extends FList[F] | |
} | |
implicit class FunOps[F[_], A, B](f: A => F[B]) extends AnyVal { | |
def toFList: FList.One[F, A, B] = FList.One(f) | |
def +:[C, D](f: C => F[D]): FList.Cons[F, C, D, FList.One[F, A, B]] = FList.Cons(f, toFList) | |
} | |
implicit class FListOps[F[_], Tail <: FList[F]](tail: Tail) extends AnyVal { | |
def +:[A, B](f: A => F[B]): FList.Cons[F, A, B, Tail] = FList.Cons(f, tail) | |
} | |
trait FListFunc[F[_], O]] { | |
def runFun[A, B](f: A => F[B]): O // SAM | |
def apply[FL <: FList[F]](flist: FL): NonEmptyList[O] = ... | |
def fold[FL <: FList[F]](flist: FL)(implicit O: Monoid[O]): O = ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment