
#7354: Panic with recursion-schemes package and unit -------------------------------+-------------------------------------------- Reporter: amplitwist | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.6.1 Keywords: | Os: Linux Architecture: x86_64 (amd64) | Failure: GHCi crash Difficulty: Unknown | Testcase: indexed_types/T7354a, T7354b Blockedby: | Blocking: Related: | -------------------------------+-------------------------------------------- Comment(by shachaf): For what it's worth, elliott in #haskell came across this bug in a different context. Here are two simpler cases (7.6.1): * Panics: {{{ type family T :: * -> * x :: () x = undefined :: T a }}} * Doesn't panic, but type-checks when it shouldn't: {{{ type family T :: * -> * x :: () x = undefined :: (b ~ T a) => b }}} Note that if you make an instance of T (e.g. `newtype Id a = Id a; type instance T = Id`), then even uses of Id unrelated to `x` cause a panic, as long as `x` exists. `-dcore-lint` catches the first case before it gets to a "real" panic. None of this is problematic in HEAD. Note: I haven't managed to get `unsafeCoerce` out of this, but that doesn't mean it's impossible. It's important to keep in mind that in the presence of SafeHaskell, type checker bugs can have security implications. Maybe `-XSafe` should imply/suggest `-dcore-lint`, or something along those lines? That's come up in a few other places, like #7453. Using SafeHaskell safely should be as easy as possible, not rely on obscure folklore and "compiler debugging options". -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7354#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler