[GHC] #12648: Stack overflow when using monad-unlift

#12648: Stack overflow when using monad-unlift -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time Unknown/Multiple | crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I found that with the following simple program I could make runghc/ghci crash with `*** Exception: stack overflow`: {{{ #!/usr/bin/env stack -- stack --resolver lts-7.1 --install-ghc runghc --package monad- unlift-0.2.0 {-# LANGUAGE FlexibleContexts #-} import Control.Monad.Trans.Unlift f :: (MonadBaseUnlift m IO) => m a f = do _ <- askUnliftBase return () }}} I'm not super sure if that's OK. Probably not; even if it does trigger an undecideable case, shouldn't ghc tell me about it instead of just crashing? The `monad-unlift` code used is here: https://github.com/fpco/monad- unlift/blob/adb7869adccc66247cbb1a6175277802e9c098e1/monad- unlift/Control/Monad/Trans/Unlift.hs -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12648 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12648: Stack overflow when using monad-unlift -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nh2): Aha, I made a simple mistake: I wrote `MonadBaseUnlift m IO` instead of `MonadBaseUnlift IO m`. I assume that's a result of `UndecidableSuperClasses` used at https://github.com/fpco/monad- unlift/blob/adb7869adccc66247cbb1a6175277802e9c098e1/monad- unlift/Control/Monad/Trans/Unlift.hs#L13. So, the remainder of this ticket is probably: Can we make GHC tell us what the problem here is (e.g. with a message like `Gave up trying to resolve ... something something` instead of the crash)? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12648#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12648: Stack overflow when using monad-unlift
-------------------------------------+-------------------------------------
Reporter: nh2 | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
crash | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ryan Scott

#12648: Stack overflow when using monad-unlift -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Compile-time | Test Case: crash | typecheck/should_fail/T12648 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * testcase: => typecheck/should_fail/T12648 * resolution: => fixed Comment: Fortunately, commit ce97b7298d54bdfccd9dcf366a69c5617b4eb43f (Expand given superclasses more eagerly) happened to fix this bug, and it made it in time for GHC 8.0.2. To be on the safe side, I've added a regression test as well. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12648#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC