
#11982: Typechecking fails for parallel monad comprehensions with polymorphic let (GHC 7.10.3 through 8.6.3) -------------------------------------+------------------------------------- Reporter: simonpj | Owner: josefs Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: ApplicativeDo Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by vdukhovni): I don't know whether the below observation is at all useful, but it seems that while let-bound polymorphism is restricted by ApplicativeDo, the same does not appear to be the case with "where". Thus changing the code as follows: {{{ main = do line <- getLine lock <- newMVar () - let locker :: Locker + go line lock + where + go line lock = + f line locker + where + locker :: Locker locker = withMVar lock . const - f line locker }}} makes the module compile. I don't know whether it is possible to perform that kind of transformation automatically. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11982#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler