Skip to content
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

Support for literate Haskell #1081

Open
Alecton4 opened this issue Dec 18, 2023 · 3 comments
Open

Support for literate Haskell #1081

Alecton4 opened this issue Dec 18, 2023 · 3 comments

Comments

@Alecton4
Copy link

Alecton4 commented Dec 18, 2023

Is your feature request related to a problem? Please describe.
Looks like ormolu does not support literate Haskell, see details.

Describe the solution you'd like
Able to format literate Haskell.

Describe alternatives you've considered
N/A

Additional context
I'm new to Haskell so not familiar with the tooling. I guess there's certain reasons we do not support literate Haskell? If so, are there other tools can be used?

@Alecton4 Alecton4 changed the title Support for literal Haskell Support for literate Haskell Dec 18, 2023
@amesgen
Copy link
Member

amesgen commented Dec 18, 2023

Thanks for the suggestion! I think implementing support for Literate Haskell should be feasible (ie as supported by the unlit program shipped with GHC), such that eg

# A Literate Haskell File

Some imports

> import B
> import A

Very interesting code:

> data A   =   B

is formatted to

# A Literate Haskell File

Some imports

> import A
> import B

Very interesting code:

> data A = B

Is that what you are having in mind?

@Alecton4
Copy link
Author

@amesgen Yes! Formatting the code parts in literate Haskell is exactly what I mean, sorry for not clearly specifying it. BTW, may I ask the reason why this snippet

> import A
> import B

should be formatted to this one?

> import B
> import A

@amesgen
Copy link
Member

amesgen commented Dec 19, 2023

Ah, thanks for pointing that out, that was just a mistake, it should be exactly reversed, I edited the comment 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants