[GHC] #11835: ApplicativeDo failed to desugar last line with pure $ <expr>

GHC ghc-devs at haskell.org
Thu Jun 30 07:09:59 UTC 2016


#11835: ApplicativeDo failed to desugar last line with pure $ <expr>
-------------------------------------+-------------------------------------
        Reporter:  Cosmia            |                Owner:  simonmar
            Type:  bug               |               Status:  merge
        Priority:  normal            |            Milestone:  8.0.2
       Component:  Compiler          |              Version:  8.0.1-rc2
      Resolution:                    |             Keywords:  ApplicativeDo
Operating System:  MacOS X           |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11607            |  Differential Rev(s):  Phab:D2345
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by EyalLotem):

 Could be interesting to detect pure/return via their type though, rather
 than name.

 If you have a function of type: (a -> m a) with up to Monad constraints on
 the m, then you can consider it a "return".

 For example, here:
 ($) return :: Monad m => a -> m a
 No special casing needed, it's the type of return so it must *be* return.

 This would currently break down due to fail:

 const (fail "boo!") :: Monad m => a -> m a

 But that will be fixed once fail is taken the hell out of Monad.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11835#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list