Skip to content

Enabling UnboxedSums breaks :ctags feature

Summary

UnboxedSums is introduced in 8.2. When this extension is enabled, GHCi's :ctags command doesn't work.

Steps to reproduce

With a typical Haskell module file like:

-- Example.hs

module Example where

a :: a
a = a

The :ctags command in GHCi will work just fine, without any error messages:

> :l Example
[1 of 1] Compiling Example          ( /home/user/code/ctags-with-unboxed-sums/library/Example.hs, interpreted )
Ok, one module loaded.
*Example> :ctags
*Example>

... and the generated tags file would look like this:

a	/home/user/code/ctags-with-unboxed-sums/library/Example.hs	6;"	v

Now let's delete the tags file and retry, with the UnboxedSums extension enabled:

{-# language UnboxedSums #-}

-- Example.hs

module Example where

a :: a
a = a

GHCi starts complaining about "not interpreted":

*Example> :l Example
[1 of 1] Compiling Example          ( /home/user/code/ctags-with-unboxed-sums/library/Example.hs, /tmp/ghc713364_0/ghc_23.o )
Ok, one module loaded.
Prelude Example> :ctags
module 'Example' is not interpreted
Prelude Example>

... and no tags file is generated.

Expected behavior

:ctags should work even when UnboxedSums is enabled.

Environment

  • GHC version used: 8.10.2
  • Operating System: GNU/Linux (Linux kernel 5.4.65-1-lts)
  • System Architecture: x86_64

Comment

I stumbled upon this bug while working on a 50-file Haskell project, so it took me a lot of git checkout and scratching my head to figure out why :ctags would stop working all of a sudden... Please tell me the effort was worthwhile 😂

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information