[GHC] #10892: ApplicativeDo should use *> and <*

GHC ghc-devs at haskell.org
Mon Feb 29 17:38:43 UTC 2016


#10892: ApplicativeDo should use *> and <*
-------------------------------------+-------------------------------------
        Reporter:  simonmar          |                Owner:  simonmar
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.11
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by sjcjoosten):

 How about a program that would turn a sequence of characters into a
 sequence of space-characters of the same length? Such a program could be
 written as part of a pretty-printer or other template-like code.

 {{{
 asIndentation chars = do{_<-chars;return ' '}::Seq Char
 }}}

 This particular example would benefit asymptotically from replacing {{{(\_
 -> pure ' ') <$>}}} with {{{pure ' ' <$}}}.

 On a side note, I ran into this strange (but understandable) behavior, not
 sure if it should be considered a bug:
 {{{
 Prelude Data.Sequence> :t (\x -> do{_ <- x; return x})
 (\x -> do{_ <- x; return x}) :: Functor f => f t -> f (f t)
 Prelude Data.Sequence> :t (\x -> do{_ <- x; pure x})
 (\x -> do{_ <- x; pure x}) :: Monad m => m a -> m (m a)
 Prelude Data.Sequence> :t (\x -> do{pure x})
 (\x -> do{pure x}) :: Applicative f => a -> f a
 Prelude Data.Sequence> :t (\x -> do{return x})
 (\x -> do{return x}) :: Monad m => a -> m a
 }}}

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


More information about the ghc-tickets mailing list