https://github.com/pure4s/uuid4s
Purely functional UUID's for Scala
https://github.com/pure4s/uuid4s
cats cats-effect circe fast-uuid functional-programming library scala uuid
Last synced: 2 months ago
JSON representation
Purely functional UUID's for Scala
- Host: GitHub
- URL: https://github.com/pure4s/uuid4s
- Owner: pure4s
- License: mit
- Created: 2019-01-13T14:21:19.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-04T21:53:11.000Z (about 7 years ago)
- Last Synced: 2025-06-13T03:47:53.145Z (9 months ago)
- Topics: cats, cats-effect, circe, fast-uuid, functional-programming, library, scala, uuid
- Language: Scala
- Homepage: http://pure4s.org/uuid4s
- Size: 837 KB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# uuid4s
[comment]: # (Start Badges)
[](https://travis-ci.org/pure4s/uuid4s)
[](https://oss.sonatype.org/#nexus-search;gav~org.pure4s~uuid4s*)
[](https://codecov.io/gh/pure4s/uuid4s)
[](https://github.com/pure4s/uuid4s/issues)
[](https://github.com/pure4s/uuid4s/pulls)
[](https://opensource.org/licenses/MIT)
[comment]: # (End Badges)
uuid4s is yet another functional uuid for Scala. It tries to be typeful and purely functional. Java UUID’s aren’t safe and are not referentially transparent. The objetive of this library is provide a set of tools for interacting with FUUID’s.
## Installation
Add the following to your `build.sbt`.
```scala
// For Scala 2.11, or 2.12
libraryDependencies += "org.pure4s" %% "uuid4s" % "0.1.5"
```
## Rationale
1. It's easy to use.
3. It does not force a specific target context. You can run your computations in any type `F[_]` that has an instance of cats-effect's `Sync[F]`.
4. It has [documentation][docs].
5. [It's modular](#modules).
[docs]: http://pure4s.org/uuid4s/
[circe]: http://circe.io
[fast-uuid]: https://github.com/jchambers/fast-uuid
[http4s]: https://http4s.org/
[akka-http]: https://doc.akka.io/docs/akka-http/current/index.html?language=scala
## Modules
| Module name | Description | Version |
| -------------------- | ------------------------------------------------------------ | ------- |
| `uuid4s` | The core functionality of uuid4s | `0.1.5` |
| `uuid4s-fast` | Use fast uuid [fast-uuid][fast-uuid] | `0.1.5` |
| `uuid4s-circe` | Encode and decode HTTP entities with [Circe][circe] | `0.1.5` |
## Usage
Example:
```scala
import java.util.UUID
import cats.effect.IO
import org.pure4s.uuid4s.FUUID
object Main extends App {
// Parsing
val uuid1: UUID = FUUID[IO].fromString("7cfb70a9-0764-4851-a28c-309393aea2eb").unsafeRunSync()
// uuid1: java.util.UUID = 7cfb70a9-0764-4851-a28c-309393aea2eb
// Generating
val uuid2: UUID = FUUID[IO].random.unsafeRunSync()
// uuid2: java.util.UUID = f94e2de4-1c08-4189-9664-105954589e52
}
```
## Code of conduct
People are expected to follow the [conduct-code] when discussing the project on the available communication channels.
[docs]: https://typepure.github.io/uuid4s/
[circe]: http://circe.io
[fast-uuid]: https://github.com/jchambers/fast-uuid
[http4s]: https://http4s.org/
[akka-http]: https://doc.akka.io/docs/akka-http/current/index.html?language=scala
[conduct-code]: https://www.scala-lang.org/conduct/