fendor / hsimport

Extend the import list of a Haskell source file
Other
38 stars 10 forks source link

Inserts module between haddock documentation and function. #16

Closed fendor closed 5 years ago

fendor commented 5 years ago

Example is roughly taken from stack new test haskeleton Example.hs

-- | An example module.
module Example (main) where

-- | An example function.
main :: IO ()
main = return ()

foo :: IO ()
foo = do
    _ <- async $ return ()
    return ()
> hsimport -m "Control.Concurrent.Async" Example.hs

Output:

-- | An example module.
module Example (main) where

-- | An example function.
import Control.Concurrent.Async
main :: IO ()
main = return ()

foo :: IO ()
foo = do
    _ <- async $ return ()
    return ()

Expected:

-- | An example module.
module Example (main) where

import Control.Concurrent.Async
-- | An example function.
main :: IO ()
main = return ()

foo :: IO ()
foo = do
    _ <- async $ return ()
    return ()
dan-t commented 5 years ago

The current github version should now consider haddock comments. Can you please verify it with your use case.

fendor commented 5 years ago

On master, the problem is solved!