Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something is amuck with template-haskell #40

Open
ahubers opened this issue May 19, 2022 · 1 comment
Open

Something is amuck with template-haskell #40

ahubers opened this issue May 19, 2022 · 1 comment
Labels
bug Something isn't working Low Priority Things that are good to have but not needed

Comments

@ahubers
Copy link
Contributor

ahubers commented May 19, 2022

What

When building unordered-containers w/ PTC, I am getting a panic from GHC for this instance in Data/HashMap/Internal/Array.hs:

instance TH.Lift a => TH.Lift (Array a) where
#if MIN_VERSION_template_haskell(2,16,0)
  liftTyped ar = [|| fromList' arlen arlist ||]
#else
  lift ar = [| fromList' arlen arlist |]
#endif
    where
      arlen :: Int
      arlen = I# (sizeofSmallArray# (unArray ar))
      arlist = toList ar

The panic is:

<no location info>: error:
    panic! (the 'impossible' happened)
  GHC version 9.3.20220511:
	bind_args
  I#
  [ww, ww, ww]
  [sizeofSmallArray# @a ds]
  scrut: I# (sizeofSmallArray# @a ds)
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:186:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/Core/Opt/Simplify.hs:3307:7 in ghc:GHC.Core.Opt.Simplify

I am kicking this issue down the river by commenting out any Template-Haskell support. Logging here for now.

Reproduction Steps

Follow instructions here to build unordered-containers package. Uncomment the instance TH.Lif a => ... line above in Data/Hashmap/Internal/Array.hs.

@ahubers ahubers added bug Something isn't working Low Priority Things that are good to have but not needed labels May 19, 2022
@fxdpntthm
Copy link
Collaborator

fxdpntthm commented May 23, 2022

Template-haskell does not interact well with our elaboration machinery.
The crux of the problem is that desugaring of quoted expressions with elaborated type signature is irregular.
I don't think this is low priority. Rather a limitation of the current work/future work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Low Priority Things that are good to have but not needed
Projects
None yet
Development

No branches or pull requests

2 participants