Skip to content

Commit

Permalink
combinators
Browse files Browse the repository at this point in the history
  • Loading branch information
ValdemarGr committed Nov 10, 2023
1 parent ea6810b commit 227b50e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/core/src/main/scala/hxl/Hxl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ final case class HxlM[F[_], A](hxl: Hxl[F, A]) {
}

object HxlM {
def unit[F[_]]: HxlM[F, Unit] = HxlM(Hxl.unit[F])

def liftF[F[_]: Functor, A](fa: F[A]): HxlM[F, A] = HxlM(Hxl.liftF(fa))

def pure[F[_], A](a: A): HxlM[F, A] = HxlM(Hxl.pure(a))

def apply[F[_], K, V](k: K, source: DataSource[F, K, V]): HxlM[F, Option[V]] =
HxlM(Hxl(k, source))

def force[F[_]: ApplicativeThrow, K: Show, V](k: K, source: DataSource[F, K, V]): HxlM[F, V] =
HxlM(Hxl.force(k, source))

def monadicK[F[_]]: Hxl[F, *] ~> HxlM[F, *] = new (Hxl[F, *] ~> HxlM[F, *]) {
def apply[A](fa: Hxl[F, A]): HxlM[F, A] = fa.monadic
}
Expand Down

0 comments on commit 227b50e

Please sign in to comment.