liquidhaskell
liquidhaskell copied to clipboard
Odd GHC panic `getFunName`
GHC panic
When using LH in plugin mode with either voltron or disco we get this error (if we disable --compile-spec) on the Auth.hs module
https://github.com/binah-framework/voltron/tree/package
ghc: panic! (the 'impossible' happened)
(GHC version 8.10.2:
Uh oh.
getFunName on Control.Monad.Time.$fMonadTimet
@ (Control.Monad.Trans.Reader.ReaderT
Database.Persist.Sql.Types.Internal.SqlBackend
(Frankie.Config.ConfigT
Controllers.Config
(Frankie.Controller.ControllerT Binah.Infrastructure.TIO)))
@ (Binah.Infrastructure.TaggedT
(Database.Persist.Class.PersistEntity.Entity Model.User))
$dMonadTime_atSa
lq_anf$##7205759403792912202
Also when checking the Server.hs file we get this:
[13 of 13] Compiling Server
ghc: panic! (the 'impossible' happened)
(GHC version 8.10.2:
error-strictResolveSymUnknown type constructor `Update`
ofBDataDecl-2
CallStack (from HasCallStack):
error, called at src/Language/Fixpoint/Misc.hs:152:14 in liquid-fixpoint-0.8.10.2.1-2YB6ojANCz25qTCkqBw6u8:Language.Fixpoint.Misc
unless we add the bogus imports ...
import Binah.SMTP -- TODO: DUMMY RECURSIVE IMPORTS for LH
import Binah.Updates -- TODO: DUMMY RECURSIVE IMPORTS for LH
I've experienced a similar bug a couple of times recently, though it's very hard to reproduce and seems sometimes to relate to cached compilation files. Here are the situations that I've found the error and how I worked around it.
First example:
<no source information>:1:1: error:
• Unknown type constructor `Data.Map.Internal.Map`
matchTyCon: Data.Map.Internal.Map
•
- This error occurs (I think) in a module
Awhich defines anewtype. Its possible that the bug is actually triggered in another module which importsA. It's not clear. - I've worked-around this error by adding a noop data refinement in module
Ato thenewtypein question. I don't know why this resolves the issue.{-# LANGUAGE QuasiQuotes #-}import LiquidHaskell (lq)[lq| newtype Foo = Foo (Map UUID ...) |]
Second example:
<no source information>:1:1: error:
• Unknown type constructor `Data.UUID.Types.Internal.UUID`
matchTyCon: Data.UUID.Types.Internal.UUID
•
- This error occurs (I think) in module
Bwhich imports the moduleAabove. - I've worked-around this error by adding
import Data.UUID (UUID)to moduleBas recommended by @ranjitjhala.