We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be cool if this worked:
type NonEmptySeq[A] = immutable.Seq[A] Refined NonEmpty object NonEmptySeq { def apply[A]: RefinedTypeOps[NonEmptySeq[A], immutable.Seq[A]] = { new RefinedTypeOps[NonEmptySeq[A], immutable.Seq[A]] } } val a = "refined" val b = "types" :: "are" :: "cool!" NonEmptySeq[String](a :: b) // or at least NonEmptySeq[String](::(a, b))
The text was updated successfully, but these errors were encountered:
This seems to work:
object collection { type NonEmptyList[A] = List[A] Refined NonEmpty object NonEmptyList { class NonEmptyListOps[A] extends RefinedTypeOps[NonEmptyList[A], List[A]] { def fromCons(cons: ::[A]): NonEmptyList[A] = Refined.unsafeApply(cons) } def apply[A]: NonEmptyListOps[A] = new NonEmptyListOps[A] } }
scala> NonEmptyList[String].fromCons(::("hello", Nil)) res5: NonEmptyList[String] = List(hello)
I'm open to adding this to the types package.
types
Sorry, something went wrong.
No branches or pull requests
It would be cool if this worked:
The text was updated successfully, but these errors were encountered: