Weird recursive type parameter definitions #15627
s5bug
started this conversation in
General Discussion
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was thinking about how to build a
Tuple
/HList
more friendly to various subtyping restrictions. I settled onas a first attempt. This would let one emulate the normal tuple like so:
or a Tuple where all items have an upper bound:
My further goal however was to support weird ways to restrict the head of an HList type based on the tail:
Of course, Scala is not a fan of the weird recursion/inner-fbounding that I would do to make this work. (That is to say, the Scala compiler doesn't support this kind of typing.)
The question was brought up to me of whether or not this sort of recursive typing would still be sound. My assumption for why Scala doesn't support it was because it seems like an absolute pain to handle, but I don't know enough about F-bounds or related topics to even begin to figure out whether or not this would be sound or unsound.
Beta Was this translation helpful? Give feedback.
All reactions