YPares / porcupine

Express parametrable, composable and portable data pipelines
89 stars 11 forks source link

Arrow notation plays badly with GADTs ("the impossible happened" on GHC 8.6.5) #75

Open YPares opened 4 years ago

YPares commented 4 years ago

This issue is due to a GHC bug, most likely something similar to https://gitlab.haskell.org/ghc/ghc/issues/16887.

It seems that on some occasions, if you try to pattern match inside arrow notation on a record (with FV for instance) you get:

ghc: panic! (the 'impossible' happened)
  (GHC version 8.6.5 for x86_64-unknown-linux):
    StgCmmEnv: variable not found
  $dShow_aiZk
  local binds for:
  $trModule
  $trModule3
  $trModule1
  ...

This is similar to what example0 does, except in this case, it doesn't cause any problem.

I'll try to cook up a minimal repro that doesn't use porcupine.

YPares commented 4 years ago

In the meantime, there is an easy workaround:

If in a proc block a code similar to the following exhibits the problem:

  (FV numF :& FV numC :& _) <- getOptions ["options"] defOpts -< ()

Then just change it to:

  opts <- getOptions ["options"] defOpts -< ()
  let (FV numF :& FV numC :& _) = opts
YPares commented 4 years ago

@goldfirere @aspiwack maybe you guys would have an input on that bug?

goldfirere commented 4 years ago

This is almost surely https://gitlab.haskell.org/ghc/ghc/issues/16887 (as you guessed). We know the fix for that ticket, but it's not terribly quick. I have a start from several months ago, but never got around to finishing the work. I can move this up in my queue.