Skip to content

Commit

Permalink
Format functor (#817)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakoito authored and raulraja committed Apr 25, 2018
1 parent 606e6b9 commit 3f930b1
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ interface Functor<F> {
fa.map(f)
}

fun <A> Kind<F, A>.void(): Kind<F, Unit> = map({ _ -> Unit })
fun <A> Kind<F, A>.void(): Kind<F, Unit> = map { _ -> Unit }

fun <A, B> Kind<F, A>.fproduct(f: (A) -> B): Kind<F, Tuple2<A, B>> = map({ a -> Tuple2(a, f(a)) })
fun <A, B> Kind<F, A>.fproduct(f: (A) -> B): Kind<F, Tuple2<A, B>> = map { a -> Tuple2(a, f(a)) }

fun <A, B> Kind<F, A>.`as`(b: B): Kind<F, B> = map({ _ -> b })
fun <A, B> Kind<F, A>.`as`(b: B): Kind<F, B> = map { _ -> b }

fun <A, B> Kind<F, A>.tupleLeft(b: B): Kind<F, Tuple2<B, A>> = map({ a -> Tuple2(b, a) })
fun <A, B> Kind<F, A>.tupleLeft(b: B): Kind<F, Tuple2<B, A>> = map { a -> Tuple2(b, a) }

fun <A, B> Kind<F, A>.tupleRight(b: B): Kind<F, Tuple2<A, B>> = map({ a -> Tuple2(a, b) })
fun <A, B> Kind<F, A>.tupleRight(b: B): Kind<F, Tuple2<A, B>> = map { a -> Tuple2(a, b) }

fun <B, A : B> Kind<F, A>.widen(): Kind<F, B> = this
}

0 comments on commit 3f930b1

Please sign in to comment.