summaryrefslogtreecommitdiff
path: root/src/utils/FunctionUtils.scala
blob: 7456898bb9cba463c8627d848dd82e6a226a10db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
package ixee.cryptopals.utils

object FunctionUtils {
  // Because doing (_ f _).tupled confuses the inferencer...
  def tup[A, B, C](f: (A, B) => C): ((A, B)) => C = f.tupled

  def iden[A](x: A) = x

  implicit class Compositor[A, B](f: A => B) {
    def :|[C](g: B => C): A => C = f.andThen(g)
  }
}