Skip to content

ApplicativeDo should use *> and <*

From @ekmett:

Would it be possible to tweak the generation to use (<*) or (*>) where appropriate when the result isn't being used?

For many Applicatives this can be a massive asymptotic win in terms of sharing and/or computational cost.

When desugaring using (<*) you'd just omit any handling of the unused result instead.

(\x y -> ...) <$> foo <* bar <*> baz

corresponds to

do x <- foo
  bar
  y <- baz
  return ...
Trac metadata
Trac field Value
Version 7.11
Type Task
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC ekmett
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information