summaryrefslogtreecommitdiffhomepage
path: root/lib/Language/Haskell/Stylish/Parse.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Language/Haskell/Stylish/Parse.hs')
-rw-r--r--lib/Language/Haskell/Stylish/Parse.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Language/Haskell/Stylish/Parse.hs b/lib/Language/Haskell/Stylish/Parse.hs
index 724ebe2..01def63 100644
--- a/lib/Language/Haskell/Stylish/Parse.hs
+++ b/lib/Language/Haskell/Stylish/Parse.hs
@@ -44,11 +44,11 @@ unCpp = unlines . go False . lines
--------------------------------------------------------------------------------
--- | Remove shebang from the first line
+-- | Remove shebang lines
unShebang :: String -> String
-unShebang str
- | "#!" `isPrefixOf` str = unlines $ ("" :) $ drop 1 $ lines str
- | otherwise = str
+unShebang str =
+ let (shebangs, other) = break (not . ("#!" `isPrefixOf`)) (lines str) in
+ unlines $ map (const "") shebangs ++ other
--------------------------------------------------------------------------------