retrie icon indicating copy to clipboard operation
retrie copied to clipboard

Invalid indentation in do notation produced by `--adhoc 'forall a. id $ a = a'`

Open watashi opened this issue 3 years ago • 3 comments

For Test.hs:

main :: IO ()
main = do
  x <- getLine
  id $
    print $
      x ++ x

retrie --adhoc 'forall a. id $ a = a' will produce:

main :: IO ()
main = do
  x <- getLine
  
    print $
      x ++ x

which is not valid code due to bad indentation.

watashi avatar Aug 17 '21 01:08 watashi

Ugh I thought I had fixed this. Will investigate.

xich avatar Aug 18 '21 04:08 xich

Ugh I thought I had fixed this. Will investigate.

FWIW, a simpler version

main :: IO ()
main = do
  x <- getLine
  id $
    print x

is currently handled properly to produce

main :: IO ()
main = do
  x <- getLine
  print x

seems like something is missed when the rhs is more complicated.

watashi avatar Aug 18 '21 05:08 watashi

Yeah, I suspect I broke it with my recent commit that generalized the elaboration. I used to have special handling for $, which I suspect resulted in the annotations moving correctly.

xich avatar Aug 18 '21 07:08 xich