-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
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
Move FUUIDVar#unapply into FUUID? #70
Comments
The type having an unapply that exposes itself internally seems odd, and exposing something that interacts with the underlying is unsafe in a way I would prefer not to expose. How do you see this being used outside of http4s dsl? |
One example I have from a project of mine goes a follows: import io.estatico.newtype.macros.newtype
import io.chrisdavenport.fuuid.FUUID
import io.chrisdavenport.fuuid.http4s.FUUIDVar
@newtype case class UserId(value: FUUID)
object UserId {
def unapply(str: String): Option[UserId] = FUUIDVar.unapply(str).map(UserId(_))
} And I will then use In this case, I had to bring in Anyway, this is just an example, and I'm not particularly attached to the proposal. It just seemed strange to be forced to depend on the |
I would think using the core types would be more direct. Since it doesn't go through the indirection. We could probably put a helper in to do the option conversion.
|
If using #85 - this could be I guess I'm not seeing what the unapply is exposing. As its not part of a larger hierarchy or any other system that it could be yanked out of generally. However I basically only use unapply for the http4s dsl use. |
Yeah, a |
FUUIDVar
from thehttp4s
module simply defines anunapply
method, which is "standard" and not specific to http4s in any way.Could it make sense to move that
unapply
into the coreFUUID
object so that one would get path extractors out of the box without the extra dependency?I understand that conceptually the
unapply
method is there to support http4s extractors, but it could technically be useful in any othermatch
clause regardless of https.This is a result of the cool design of http4s' DSL, and it would be interesting to exploit it :)
The
http4s
module is still useful for http4s-specific things like #69The text was updated successfully, but these errors were encountered: