eidos


License

License

MIT
GroupId

GroupId

org.systemfw
ArtifactId

ArtifactId

eidos_2.12
Last Version

Last Version

0.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

eidos
eidos
Project URL

Project URL

https://github.com/SystemFw/eidos
Project Organization

Project Organization

org.systemfw
Source Code Management

Source Code Management

https://github.com/SystemFw/eidos

Download eidos_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/org.systemfw/eidos_2.12/ -->
<dependency>
    <groupId>org.systemfw</groupId>
    <artifactId>eidos_2.12</artifactId>
    <version>0.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.systemfw/eidos_2.12/
implementation 'org.systemfw:eidos_2.12:0.1.1'
// https://jarcasting.com/artifacts/org.systemfw/eidos_2.12/
implementation ("org.systemfw:eidos_2.12:0.1.1")
'org.systemfw:eidos_2.12:jar:0.1.1'
<dependency org="org.systemfw" name="eidos_2.12" rev="0.1.1">
  <artifact name="eidos_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.systemfw', module='eidos_2.12', version='0.1.1')
)
libraryDependencies += "org.systemfw" % "eidos_2.12" % "0.1.1"
[org.systemfw/eidos_2.12 "0.1.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.1

test (4)

Group / Artifact Type Version
org.specs2 : specs2-core_2.12 jar 3.8.8
org.specs2 : specs2-matcher-extra_2.12 jar 3.8.8
org.specs2 : specs2-scalacheck_2.12 jar 3.8.8
org.scalacheck : scalacheck_2.12 jar 1.13.4

Project Modules

There are no modules declared in this project.

Eidos

Eidos is a tiny and principled library for modelling IDs. It does one thing and does it well, allowing you to build tagged IDs with à la carte pretty-printing and validation, and an emphasis on type safety and correct-by-construction code. We can do better than String.

import eidos._

case object QnD
type QnD = QnD.type

case object Customer extends MakeLabel with UUID
type Customer = Customer.type

case object Device extends CustomLabel with Regex {
 def pattern = "(abc)+12"
 def label = "Phone"
}
type Device = Device.type

// and then

scala > Id.of[QnD]("no validation required!")
res1: Id[QnD] = Id(no validation required!)

scala> Id.of[Customer]("e07fa50f-7ddf-4e7c-acf5-420406e5a7c5")
res2: Option[Id[Customer]] = Some(CustomerId(e07fa50f-7ddf-4e7c-acf5-420406e5a7c5))

scala> Id.of[Customer]("not-a-uuid")
res3: Option[Id[Customer]] = None

scala> Id.of[Device]("abcabc12")
res4: Option[Id[Device]] = Some(PhoneId(abcabc12))

Getting Eidos

Add the following to your build.sbt. Builds are available for scala 2.11.x and 2.12.x

libraryDependencies += "org.systemfw" %% "eidos" % "0.1.1"

Documentation

Have a look at the User Guide for detailed documentation

Versions

Version
0.1.1
0.1