summaryrefslogtreecommitdiff
path: root/src/utils/FunctionUtils.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/FunctionUtils.scala')
-rw-r--r--src/utils/FunctionUtils.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils/FunctionUtils.scala b/src/utils/FunctionUtils.scala
new file mode 100644
index 0000000..84c141b
--- /dev/null
+++ b/src/utils/FunctionUtils.scala
@@ -0,0 +1,10 @@
+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
+
+ implicit class Compositor[A, B](f: A => B) {
+ def :|[C](g: B => C): A => C = f.andThen(g)
+ }
+}