Concrete syntax for open type kind?

Conal Elliott conal at conal.net
Tue Apr 15 23:39:30 UTC 2014


I see ‘#’ for unlifted and ‘?’ for open kinds in compiler/parser/Parser.y:

akind   :: { IfaceKind }
        : '*'              { ifaceLiftedTypeKind }
        | '#'              { ifaceUnliftedTypeKind }
        | '?'              { ifaceOpenTypeKind }
        | '(' kind ')'     { $2 }

kind    :: { IfaceKind }
        : akind            { $1 }
        | akind '->' kind  { ifaceArrow $1 $3 }

However, I don’t know how to get GHC to accept ‘#’ or ‘?’ in a kind
annotation. Are these kinds really available to source programs.

I see that undefined has an open-kinded type:

*Main> :i undefined
undefined :: forall (a :: OpenKind). a      -- Defined in ‘GHC.Err’

Looking in the GHC.Err source, I just see the following:

undefined :: a
undefined =  error "Prelude.undefined"

However, if I try similarly,

q :: a
q = error "q"

I don’t see a similar type:

*X> :i q
q :: forall a. a        -- Defined at ../test/X.hs:12:1


I don't know what kind 'a' has here, nor how to find out.

-- Conal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20140415/486240d1/attachment.html>


More information about the Glasgow-haskell-users mailing list