Skip to content

Instantly share code, notes, and snippets.

@hamishdickson
Created February 21, 2017 14:23
Show Gist options
  • Save hamishdickson/fcc166c34f23e66efa5174cbb1b34e66 to your computer and use it in GitHub Desktop.
Save hamishdickson/fcc166c34f23e66efa5174cbb1b34e66 to your computer and use it in GitHub Desktop.
/*
* here is a cool thing @Astrac did
*
* lifts `A => F[B]` to `F[A => B]`, where `F` has a Comonad and an applicative
*/
def lift[F[_], A, B](f: A => F[B])(implicit cm: Comonad[F], ap: Applicative[F]): F[A => B] = ap.pure(a => f(a).extract)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment