Opened 20 months ago

Last modified 20 months ago

#14700 new bug

ApplicativeDo in MonadComprehensions

Reported by: lspitzner Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.0.2
Keywords: ApplicativeDo Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


It appears that a MonadComp (even one that is "Applicative only") is not transformed appropriately in the presence of ApplicativeDo.

{-# LANGUAGE MonadComprehensions #-}
{-# LANGUAGE ApplicativeDo #-}

value1 = [ f a b c | a <- ma, b <- mb, c <- mc ]
value2 = do { a <- ma; b <- mb; c <- mc; return (f a b c) }
value3 = f <$> ma <*> mb <*> mc

value1 should desugar to value2 via monadcomp and to value3 via appdo. Yet I observe very bad performance in some specific instance (due to a slower Monad instance) when using value1, where value2 and value3 have good performance. I have not looked at desuraged/core dumps but the observation seems clear.

Tested on ghc-8.0.2 only.

Change History (1)

comment:1 Changed 20 months ago by simonpj

Keywords: ApplicativeDo added
Note: See TracTickets for help on using tickets.