Skip to content
  • Kirill Elagin's avatar
    pretty-printer: Do not print ApplicativeDo join · 5cb93af7
    Kirill Elagin authored and Marge Bot's avatar Marge Bot committed
    * Do not print `join` in ApplictiveStmt, unless ppr-debug
    * Print parens around multiple parallel binds
    
    When ApplicativeDo is enabled, the renamer analyses the statements of a
    `do` block and in certain cases marks them as needing to be rewritten
    using `join`.
    
    For example, if you have:
    
    ```
    foo = do
      a <- e1
      b <- e2
      doSomething a b
    ```
    
    it will be desugared into:
    
    ```
    foo = join (doSomething <$> e1 <*> e2)
    ```
    
    After renaming but before desugaring the expression is stored
    essentially as:
    
    ```
    foo = do
      [will need join] (a <- e1 | b <- e2)
      [no return] doSomething a b
    ```
    
    Before this change, the pretty printer would print a call to `join`,
    even though it is not needed at this stage at all. The expression will be
    actually rewritten into one using join only at desugaring, at which
    point a literal call to join will be inserted.
    5cb93af7