{-# LANGUAGE DataKinds #-}
module Distribution.C2Hs ( defaultMainC2Hs
, c2hsUserHooks
, c2hsSuffixHandler
) where
import Control.Applicative (pure)
import Data.Traversable (traverse)
import Distribution.C2Hs.TopSort
import Distribution.Simple (UserHooks (hookedPreProcessors),
defaultMainWithHooks,
simpleUserHooks)
import Distribution.Simple.PreProcess (PPSuffixHandler,
PreProcessor (ppOrdering),
Suffix (Suffix), ppC2hs)
defaultMainC2Hs :: IO ()
defaultMainC2Hs :: IO ()
defaultMainC2Hs = UserHooks -> IO ()
defaultMainWithHooks UserHooks
c2hsUserHooks
c2hsUserHooks :: UserHooks
c2hsUserHooks :: UserHooks
c2hsUserHooks = UserHooks
simpleUserHooks { hookedPreProcessors = [c2hsSuffixHandler] }
c2hsSuffixHandler :: PPSuffixHandler
c2hsSuffixHandler :: PPSuffixHandler
c2hsSuffixHandler = (String -> Suffix
Suffix String
".chs", \BuildInfo
bi LocalBuildInfo
lbi ComponentLocalBuildInfo
cbi -> (BuildInfo
-> LocalBuildInfo -> ComponentLocalBuildInfo -> PreProcessor
ppC2hs BuildInfo
bi LocalBuildInfo
lbi ComponentLocalBuildInfo
cbi) { ppOrdering = reorderC2Hs })