Created
September 18, 2024 22:52
-
-
Save dabrowski-adam/193b6ede9d22ac99f6a773a174173c70 to your computer and use it in GitHub Desktop.
Pipe operator for Scala 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//> using scala 3.5.0 | |
package com.adamdabrowski.pipe | |
import scala.annotation.targetName | |
extension [A](x: => A) | |
@targetName("pipe") | |
inline def |>[B](inline f: A => B): B = f(x) | |
@targetName("pipeByName") | |
inline def |>[B](inline f: (=> A) => B): B = f(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment