cdepillabout / pretty-simple

pretty-printer for Haskell data types that have a Show instance
https://hackage.haskell.org/package/pretty-simple
BSD 3-Clause "New" or "Revised" License
243 stars 29 forks source link

Empty string in `stdout` instead of using handle #114

Closed Lev135 closed 2 years ago

Lev135 commented 2 years ago

As far as I understood pHPrint prints eoln at the end using putStrLn, not in handle. It was very suprising for me. Why it's do so? Is it a bug or a feature?

pHPrintStringOpt checkColorTty outputOptions Handle
handle str = do
  realOutputOpts <-
    case checkColorTty of
      CheckColorTty -> hCheckTTY handle outputOptions
      NoCheckColorTty -> pure outputOptions
  liftIO $ do
    renderIO handle $ layoutStringAnsi realOutputOpts str
    putStrLn ""

I've found it while rendering in file using pHPrint and these empty lines surprised me

cdepillabout commented 2 years ago

@Lev135 Thanks for submitting this issue!

This is very likely a bug. Would you be able to send a PR fixing this?