https://github.com/todesking/arrow_builder.scala
https://github.com/todesking/arrow_builder.scala
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/todesking/arrow_builder.scala
- Owner: todesking
- License: mit
- Created: 2015-11-07T07:25:36.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-07T07:54:46.000Z (over 10 years ago)
- Last Synced: 2025-04-09T00:25:37.548Z (about 1 year ago)
- Language: Scala
- Size: 0 Bytes
- Stars: 10
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Arrow builder for Scala
Poor man's `proc` notation (GHC) for Scala.
## Current status
Very experimental
## Usage
```scala
import com.todesking.arrow_builder.ArrowSyntax._
import com.todesking.arrow_builder.ArrowBuilder
def arr[A, B](f: A => B): MyArrow[A, B] = ???
ArrowBuilder.build[MyArrow, Int, String] { in =>
a <- arr[Int, Int](_ + 1) -< in
b <- arr[Int, Int](_ + 2) -< in
a_b <- arr[(Int, Int), Int] { case (a, b) => a * b } -< a.zip(b)
s <- arr[Int, String](_.toString) -< a_b
} yield a_b
```
## ArrowDelayLoop
`ArrowLoop` typeclass is not fit to Scala because it requires lazy evaluation.
Instead, we provide `ArrowDelayLoop` typeclass. It is analogue of `ArrowLoop` + `Arrowinit`,
but only provides `delayLoop[A, B, C](init: A, arrow: F[(A, C), (B, C)]): F[A, B]` method.
## rec
Theres no `rec`. Use `ArrowBuilder.delayLoop`