{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE RankNTypes #-}
module Distribution.Simple.PreProcess.Types
( Suffix (..)
, PreProcessor (..)
, PreProcessCommand
, builtinHaskellSuffixes
, builtinHaskellBootSuffixes
)
where
import Distribution.Compat.Prelude
import Prelude ()
import Distribution.ModuleName (ModuleName)
import Distribution.Pretty
import Distribution.Utils.Path
import Distribution.Verbosity
import qualified Text.PrettyPrint as Disp
data PreProcessor = PreProcessor
{
PreProcessor -> Bool
platformIndependent :: Bool
,
PreProcessor
-> Verbosity
-> [SymbolicPath Pkg ('Dir Source)]
-> [ModuleName]
-> IO [ModuleName]
ppOrdering
:: Verbosity
-> [SymbolicPath Pkg (Dir Source)]
-> [ModuleName]
-> IO [ModuleName]
, PreProcessor -> PreProcessCommand
runPreProcessor
:: PreProcessCommand
}
type PreProcessCommand =
(FilePath, FilePath)
-> (FilePath, FilePath)
-> Verbosity
-> IO ()
newtype Suffix = Suffix String
deriving (Suffix -> Suffix -> Bool
(Suffix -> Suffix -> Bool)
-> (Suffix -> Suffix -> Bool) -> Eq Suffix
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Suffix -> Suffix -> Bool
== :: Suffix -> Suffix -> Bool
$c/= :: Suffix -> Suffix -> Bool
/= :: Suffix -> Suffix -> Bool
Eq, Eq Suffix
Eq Suffix =>
(Suffix -> Suffix -> Ordering)
-> (Suffix -> Suffix -> Bool)
-> (Suffix -> Suffix -> Bool)
-> (Suffix -> Suffix -> Bool)
-> (Suffix -> Suffix -> Bool)
-> (Suffix -> Suffix -> Suffix)
-> (Suffix -> Suffix -> Suffix)
-> Ord Suffix
Suffix -> Suffix -> Bool
Suffix -> Suffix -> Ordering
Suffix -> Suffix -> Suffix
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Suffix -> Suffix -> Ordering
compare :: Suffix -> Suffix -> Ordering
$c< :: Suffix -> Suffix -> Bool
< :: Suffix -> Suffix -> Bool
$c<= :: Suffix -> Suffix -> Bool
<= :: Suffix -> Suffix -> Bool
$c> :: Suffix -> Suffix -> Bool
> :: Suffix -> Suffix -> Bool
$c>= :: Suffix -> Suffix -> Bool
>= :: Suffix -> Suffix -> Bool
$cmax :: Suffix -> Suffix -> Suffix
max :: Suffix -> Suffix -> Suffix
$cmin :: Suffix -> Suffix -> Suffix
min :: Suffix -> Suffix -> Suffix
Ord, Int -> Suffix -> String -> String
[Suffix] -> String -> String
Suffix -> String
(Int -> Suffix -> String -> String)
-> (Suffix -> String)
-> ([Suffix] -> String -> String)
-> Show Suffix
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Suffix -> String -> String
showsPrec :: Int -> Suffix -> String -> String
$cshow :: Suffix -> String
show :: Suffix -> String
$cshowList :: [Suffix] -> String -> String
showList :: [Suffix] -> String -> String
Show, (forall x. Suffix -> Rep Suffix x)
-> (forall x. Rep Suffix x -> Suffix) -> Generic Suffix
forall x. Rep Suffix x -> Suffix
forall x. Suffix -> Rep Suffix x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Suffix -> Rep Suffix x
from :: forall x. Suffix -> Rep Suffix x
$cto :: forall x. Rep Suffix x -> Suffix
to :: forall x. Rep Suffix x -> Suffix
Generic, String -> Suffix
(String -> Suffix) -> IsString Suffix
forall a. (String -> a) -> IsString a
$cfromString :: String -> Suffix
fromString :: String -> Suffix
IsString)
instance Pretty Suffix where
pretty :: Suffix -> Doc
pretty (Suffix String
s) = String -> Doc
Disp.text String
s
instance Binary Suffix
instance Structured Suffix
builtinHaskellSuffixes :: [Suffix]
builtinHaskellSuffixes :: [Suffix]
builtinHaskellSuffixes = (String -> Suffix) -> [String] -> [Suffix]
forall a b. (a -> b) -> [a] -> [b]
map String -> Suffix
Suffix [String
"hs", String
"lhs", String
"hsig", String
"lhsig"]
builtinHaskellBootSuffixes :: [Suffix]
builtinHaskellBootSuffixes :: [Suffix]
builtinHaskellBootSuffixes = (String -> Suffix) -> [String] -> [Suffix]
forall a b. (a -> b) -> [a] -> [b]
map String -> Suffix
Suffix [String
"hs-boot", String
"lhs-boot"]