summaryrefslogtreecommitdiff
path: root/src/utils/FunctionUtils.scala
blob: 21ad8d0d479a8b76b327c1c13681886b46487e64 (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 ident[A]: A => A = { x => x }

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