Skip to content

winery-1.3.2 panics on HEAD (expectJust isRecDataCon:go_tc_app)

(Originally discovered in a head.hackage build here.)

The winery-1.3.2 library on Hackage panics when compiled with GHC HEAD at commit bb779b90. Here is a minimized example:

{-# LANGUAGE RankNTypes #-}
module Codec.Winery.Class (extractorProduct') where

class GSerialiseProduct f where
  dummy :: f x -> ()
  productExtractor :: TransFusion [] ((->) Bool) (f Int)

extractorProduct' :: GSerialiseProduct f => Maybe (f Int)
extractorProduct' = unTransFusion productExtractor go

go :: f x -> Maybe (g x)
go _ = Nothing

newtype TransFusion f g a = TransFusion { unTransFusion :: forall h. Applicative h => (forall x. f x -> h (g x)) -> h a }
$ ~/Software/ghc-9.3.20220316/bin/ghc Bug.hs -O -fforce-recomp
[1 of 1] Compiling Codec.Winery.Class ( Bug.hs, Bug.o )

<no location info>: error:
    expectJust isRecDataCon:go_tc_app
CallStack (from HasCallStack):
  error, called at compiler/GHC/Data/Maybe.hs:71:27 in ghc:GHC.Data.Maybe
  expectJust, called at compiler/GHC/Core/Opt/WorkWrap/Utils.hs:1348:25 in ghc:GHC.Core.Opt.WorkWrap.Utils

This regression was introduced in commit 8ff32124 (DmdAnal: Don't unbox recursive data types). cc @sgraf812

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