Opened 3 weeks ago

Last modified 12 days ago

#15935 new bug

TYPE is not generated by genprimops

Reported by: davide Owned by:
Priority: normal Milestone:
Component: Core Libraries Version: 8.6.2
Keywords: newcomer Cc: harpocrates
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

During validation, GHC.Magic must build without warning, and must also type check with Haddock without warnings. This causes some awkwardness in GHC.Magic (see the comment above the imports regarding genprimops) because TYPE is exported from GHC.Prim and reexported by GHC.Types. We are forced to explicitly import it via GHC.Types (and not from GHC.Prim to avoid an unused import warnings). Importing via GHC.Prim would not type check with Haddock as genprimops doesn't generate TYPE for GHC.Prim. This issue surfaced in patch D5312.

Change History (4)

comment:1 Changed 2 weeks ago by harpocrates

I may be missing something, but I think that all TYPE needs is a primtype declaration somewhere in primops.txt:

primtype TYPE r
    {Some Haddock documentation about TYPE}

The realWorld# issue is tougher though.

comment:2 Changed 2 weeks ago by bgamari

Keywords: newcomer added; GHC.Magic TYPE haddock GHC.Prim genprimops removed

It's not quite that simple; utils/genprimop knows nothing of the r tyvar. You will need to introduce such a variable, along with a primtype for RuntimeRep itself.

comment:3 in reply to:  2 Changed 12 days ago by harpocrates

Replying to bgamari:

It's not quite that simple; utils/genprimcode knows nothing of the r tyvar. You will need to introduce such a variable, along with a primtype for RuntimeRep itself.

The r variable won't give utils/genprimopcode any problems but it won't have a kind annotation :: RuntimeRep on it. That's all temporary though. Once the Hi Haddock patch makes it into GHC/Haddock, you should even get the right kind annotation for free.

This should all be analogous to the data (->) a b patch (https://phabricator.haskell.org/D5167). (With Hi Haddock, that gets rendered as data (a :: TYPE r) -> (b :: TYPE q).)

comment:4 Changed 12 days ago by harpocrates

Cc: harpocrates added
Note: See TracTickets for help on using tickets.