https://github.com/dwolla/anorm-cats
Cats typeclass instances for the Anorm database library
https://github.com/dwolla/anorm-cats
Last synced: about 2 months ago
JSON representation
Cats typeclass instances for the Anorm database library
- Host: GitHub
- URL: https://github.com/dwolla/anorm-cats
- Owner: Dwolla
- License: mit
- Created: 2020-09-17T17:06:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-09-17T23:04:33.000Z (over 4 years ago)
- Last Synced: 2025-02-15T23:45:30.668Z (4 months ago)
- Language: Scala
- Size: 12.7 KB
- Stars: 0
- Watchers: 14
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Anorm Cats
Cats typeclass instances for Anorm types.
* `MonadError[SqlResult, Throwable]`
* `Traverse[SqlResult]`
* `Monoid[SqlResult[A]]` for any `A : Monoid`
* `Monad[RowParser]`## Usage
`import anorm.interop.cats.implicits._` to bring the instances and the syntax enhancements into scope. (More specific imports are available in the `anorm.interop.cats.syntax` and `anorm.interop.cats.instances` packages.)
### Example
```scala
import anorm._
import anorm.interop.cats.implicits._
import cats._def parseMyNumberFromRow[F[_] : ApplicativeError[*[_], Throwable]](row: Row): F[Int] =
SqlParser.get[Int]("my_number") // RowParser[Int]
.apply(row) // SqlResult[Int]
.liftTo[F] // F[Int]
```