-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use a state monad for keeping track of the output state #25
Comments
Hey, I would like to work on this. Any particular things I should keep in mind? |
@sureyeaah Thanks for taking a look at this!
I'd take a glance at the hindent source code and see how it uses Also, the printing code for pretty-simple is pretty hacky, so feel free to make big changes. There are lots(?) of tests for pretty-simple, so you should feel confident in making changes. |
@sureyeaah Oh, I did think of one more thing you should keep in mind. pretty-simple is able to parse and pretty-print lazy data structures, so it is important that this property is kept. When you are working on this, just make sure that pretty-printing lazy data structures (like |
The ExprToOutput module uses a state monad already. Where exactly is it that we need to make changes then? |
@sureyeaah The It does this by writing to a |
Another thing that might help simplify this is actually using a proper pretty-printing library: https://hackage.haskell.org/package/prettyprinter Although a big thing to keep in mind is whether this would be sufficiently lazy. |
Oh, no! ;) I actually rely on (I could probably work around a circular dependency though…) |
Note BTW that there's already http://hackage.haskell.org/package/show-prettyprint which is a bit like a |
Ah, I see :-) I guess keeping the dependencies of |
@sjakobi out of interest, would you be able to get away with:
pp :: Show a => a -> IO ()
pp = putStrLn <=< readProcess "pretty-simple" [] . show I've used this trick before to avoid actually depending on I think there's a reasonable argument for using an actual pretty-printing library, and |
Anyway, @sureyeaah, did you make any progress here? I figure it may simplify #66, as well as the existing #56 and #43. |
@georgefst Thanks, that looks like a nice trick! I think I can also recommend using |
I talked a little about this in my response in #24.
This would look similar to how it is done in hindent.
The text was updated successfully, but these errors were encountered: