tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
958 stars 83 forks source link

File header comments get moved into export list #430

Closed cdsmith closed 4 years ago

cdsmith commented 4 years ago

Ormolu 0.0.1 (latest Hackage release) turns this:

{-
    Copyright blah blah blah
-}

-- | My favorite module
module Test (foo) where

foo = 42

Into this:

-- | My favorite module
module Test
  ( {-
        Copyright blah blah blah
    -}

    foo,
  )
where

foo = 42

This must be a bug, right? Strangely, it doesn't happen if there's no haddock comment on the module.

basile-henry commented 4 years ago

This is definitely a weird behaviour and we should have a closer look at it.

Just a side note, you should be able to put the Copyright and other information about the module straight into the Haddock module description: https://www.haskell.org/haddock/doc/html/ch03s03.html

mrkkrp commented 4 years ago

This is now fixed.

cdsmith commented 4 years ago

Thanks! Looking forward to the hackage release.

I realize Haskell has some of its own conventions about how to include licensing info. In my case, I'm working with lawyers who have differing opinions, and the means to enforce them! I don't want paragraphs of legal text about the source to make it into generated documentation for every module, so this requires a separate non-haddock comment before the module comment.