#!/usr/bin/env stack
{- stack --resolver lts-16.10 script -}
module Main (main) where
main :: IO ()
main = putStrLn "hi"
In the following program, only the first way of parsing Foo.hs preserves the shebang.
import Language.Haskell.GHC.ExactPrint.Parsers
import Language.Haskell.GHC.ExactPrint.Print
main :: IO ()
main = do
Right (as, m) <- parseModule "test/Foo.hs" -- preserves shebang
Right (as, m) <- parseModule "./test/Foo.hs" -- loses shebang
Right (as, m) <- parseModule "Foo.hs" -- loses shebang
Right (as, m) <- parseModule "./Foo.hs" -- loses shebang
Right (as, m) <- parseModule "/tmp/Foo.hs" -- loses shebang
putStrLn $ exactPrint m as
First reported in https://github.com/ndmitchell/hlint/issues/1122 by @pbrisbin
Suppose the content of
Foo.hs
isIn the following program, only the first way of parsing
Foo.hs
preserves the shebang.