ormolu icon indicating copy to clipboard operation
ormolu copied to clipboard

Support for literate Haskell

Open Alecton4 opened this issue 1 year ago • 3 comments

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 avatar Dec 18 '23 09:12 Alecton4

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?

amesgen avatar Dec 18 '23 18:12 amesgen

@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

Alecton4 avatar Dec 19 '23 03:12 Alecton4

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

amesgen avatar Dec 19 '23 16:12 amesgen