Skip to content

Panic in tcSimplifyRuleLhs

With this module, both 6.8.3 and the HEAD panic in tcSimplifyRuleLhs:

{-# LANGUAGE Rank2Types, ScopedTypeVariables #-}
module Foo where

foo :: (forall m. Monad m => Maybe (m a) -> Maybe (m a)) -> Maybe a -> Maybe a
foo _ x = x

{-# RULES

"foo/foo"
  forall (f :: forall m. Monad m => Maybe (m a) -> Maybe (m a))
         (g :: forall m. Monad m => Maybe (m b) -> Maybe (m b)) x.
  foo f (foo g x) = foo (f . g) x
 #-}

Note that the rule is incorrectly typed; with the correct types, no panic happens.

Incidentially, I'm not sure if ScopedTypeVariables should be required here.

Trac metadata
Trac field Value
Version 6.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information