Covariance issues with wrapping
Open
Nobody has claimed this yet.
bug
typing
- Dominant language
- OCaml
- Stars
- 179
- Forks
- 63
- Avg merge
- 5h
- Merged PRs (30d)
- 22
Description
While working with the ppx, I noticed something ... strange.
# let x = Html5.Xml.W.nil () ;;
val x : '_a list = []
# let x : _ list = Html5.Xml.W.nil () ;;
val x : 'a list = []
Apparently, the functor stack hides the covariance, since Xml_wrap.S.tlist is not marked covariant.
@vasilisp Do you think we could turn it covariant ? Are all the wrapper we have covariants ? Given the heavy use of subtyping, It would seems natural to enforce that.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Html5.Xml.W.nil example and inspect Xml_wrap.S.tlist, then review the wrapper types involved in the functor stack. Check which wrappers can safely preserve covariance and verify that the reported inferred types no longer hide it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100