ocsigen / ocsigen/tyxml

Covariance issues with wrapping

Open
#108 3 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.