Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[1 of 1] Compiling Repro ( ScopedEffectsRepro.hs, ScopedEffectsRepro.o )
ghc: panic! (the 'impossible' happened)
(GHC version 8.6.2 for x86_64-unknown-linux):
StgCmmEnv: variable not found
$dIMonad_a1lH
local binds for:
$tc'VarE
$tcE
$tcIMonad
$trModule
return
>>=
$tc'VarE1_r1oq
$tc'VarE2_r1pa
$krep_r1pb
$krep1_r1pc
$krep2_r1pd
$krep3_r1pe
$krep4_r1pf
$tcE1_r1pg
$tcE2_r1ph
$tcIMonad1_r1pi
$tcIMonad2_r1pj
$krep5_r1pk
$krep6_r1pl
$krep7_r1pm
$trModule1_r1pn
$trModule2_r1po
$trModule3_r1pp
$trModule4_r1pq
$krep8_r1pr
$krep9_r1ps
sat_s1ro
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in ghc:Outputable
pprPanic, called at compiler/codeGen/StgCmmEnv.hs:149:9 in ghc:StgCmmEnv
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE RebindableSyntax #-}
{-# OPTIONS_GHC -Wall -Wno-missing-signatures -Wno-unticked-promoted-constructors
-Wno-name-shadowing -fwarn-partial-type-signatures -Wno-partial-type-signatures #-}
module Repro(main) where
import Prelude hiding (Monad(..))
import Control.Applicative
data E (a :: * -> *) (n :: *) where
VarE :: a n -> E a n
instance IMonad E where
return :: a n -> E a n
return = VarE
(>>=) :: E a n -> (forall n . a n -> E b n) -> E b n
VarE x >>= f = f x
class IMonad (m :: (* -> *) -> (* -> *)) where
return :: forall a n . a n -> m a n
(>>=) :: m a n -> (forall n . a n -> m b n) -> m b n
one :: Const Int n
one = (Const 1)
example_4 :: E (Const Int) n
example_4 = do
x <- (return one)
return x
main = example_4 `seq` ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment