--------------------------------------------------------------------------------
module Language.Haskell.Stylish.Step.Tabs
    ( step
    ) where


--------------------------------------------------------------------------------
import           Language.Haskell.Stylish.Step


--------------------------------------------------------------------------------
removeTabs :: Int -> String -> String
removeTabs :: Int -> String -> String
removeTabs Int
spaces = forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Char -> String
removeTabs'
  where
    removeTabs' :: Char -> String
removeTabs' Char
'\t' = forall a. Int -> a -> [a]
replicate Int
spaces Char
' '
    removeTabs' Char
x    = [Char
x]


--------------------------------------------------------------------------------
step :: Int -> Step
step :: Int -> Step
step Int
spaces = String -> (Lines -> Module -> Lines) -> Step
makeStep String
"Tabs" forall a b. (a -> b) -> a -> b
$ \Lines
ls Module
_ -> forall a b. (a -> b) -> [a] -> [b]
map (Int -> String -> String
removeTabs Int
spaces) Lines
ls