Created
March 1, 2018 18:17
-
-
Save umbreak/b4c6e2b341f1a4974108d440827d7acb to your computer and use it in GitHub Desktop.
This file contains 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
import ch.epfl.bluebrain.nexus.admin.ld.other.CustomRefinements.CustomType | |
import ch.epfl.bluebrain.nexus.admin.ld.other.ProjectRefinements.{ProjectReference, ProjectReferencePredicate} | |
import eu.timepit.refined._ | |
import eu.timepit.refined.api._ | |
import eu.timepit.refined.collection._ | |
import eu.timepit.refined.auto._ | |
import eu.timepit.refined.string.MatchesRegex | |
object Collect { | |
final case class Something(some: CustomType) | |
trait SomethingAble[A] extends (A => Something) | |
final implicit val inference: Inference[ProjectReferencePredicate, NonEmpty] = | |
Inference.alwaysValid("A Project Reference is always a valid Custom Type") | |
final implicit val projectReferenceToIdRef: SomethingAble[ProjectReference] = (a: ProjectReference) => { | |
Something(a) | |
} | |
} | |
object CustomRefinements { | |
type CustomType = String Refined NonEmpty | |
} | |
object ProjectRefinements { | |
type ProjectReferencePredicate = MatchesRegex[W.`"[a-zA-Z0-9-_]{3,16}"`.T] | |
type ProjectReference = String Refined ProjectReferencePredicate | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment