Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#10481 closed bug (fixed)

raise# should have an open kind in its return type

Reported by: gridaphobe Owned by:
Priority: normal Milestone: 8.0.1
Component: Compiler Version: 7.11
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: primops/should_run/T10481
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D1116
Wiki Page:


I noticed this while working on error has a wired-in type

error :: forall (a :: OpenKind). String -> a

and an implementation

error :: String -> a
error s = raise# (errorCallException s)

But GHC will actually reject the definition of error if you check it against the wired-in type as raise# has a lifted kind.

The only reason we can compile base is that open kinds cannot be expressed in Haskell source, so when GHC compiles GHC.Err it thinks error has a lifted kind, but for every other module it uses the wired-in type with an open kind.

I'm marking this as low priority because I don't see how it could affect anyone outside of GHC developers, since open kinds aren't expressible in the source language.

Change History (6)

comment:1 Changed 4 years ago by simonpj

Milestone: 7.12.1
Priority: lownormal

No, it can affect anyone:

{-# LANGUAGE MagicHash #-}
module Foo where
import GHC.Prim

f :: Int -> Int#
f x = raise# x

This wrongly yields

    Kind incompatibility when matching types:
      b0 :: *
      Int# :: #
    In the expression: raise# x
    In an equation for ‘f’: f x = raise# x

comment:2 Changed 4 years ago by rwbarton

Differential Rev(s): Phab:D1116

comment:3 Changed 4 years ago by Reid Barton <rwbarton@…>

In ad089f58/ghc:

Give raise# a return type of open kind (#10481)

Test Plan: validate

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, thomie

Differential Revision:

GHC Trac Issues: #10481

comment:4 Changed 4 years ago by rwbarton

Resolution: fixed
Status: newclosed

comment:5 Changed 4 years ago by simonpj

Test Case: primops/should_run/T10481

Thanks; don't forget to fill in the Test Case field though.

comment:6 Changed 4 years ago by thoughtpolice


Milestone renamed

Note: See TracTickets for help on using tickets.