Skip to content

Example in ghc doc for SAKS doesn't work

Not sure if this is a bug or a documentation issue, but an example from the ghc docs on SAKS doesn't compile:

{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}

import Data.Kind

type GProx4 :: k -> Type
data GProx4 :: w where MkGProx4 :: GProx4 a
[nix-shell:~]$ ghci --version
The Glorious Glasgow Haskell Compilation System, version 9.2.2

[nix-shell:~]$ ghci /tmp/asdf.hs
GHCi, version 9.2.2: https://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/googleson78/.ghci
[1 of 1] Compiling Main             ( /tmp/asdf.hs, interpreted )

/tmp/asdf.hs:10:1: error:
    • Couldn't match expected kind ‘w’ with actual kind ‘k -> *’
    • In the data type declaration for ‘GProx4’
   |
10 | data GProx4 :: w where MkGProx4 :: GProx4 a
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.
>
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information