module Distribution.Types.BuildType (
BuildType(..),
knownBuildTypes,
) where
import Prelude ()
import Distribution.Compat.Prelude
import Distribution.Pretty
import Distribution.Parsec.Class
import Distribution.Text
import qualified Distribution.Compat.Parsec as P
import qualified Distribution.Compat.ReadP as Parse
import qualified Text.PrettyPrint as Disp
data BuildType
= Simple
| Configure
| Make
| Custom
| UnknownBuildType String
deriving (Generic, Show, Read, Eq, Typeable, Data)
instance Binary BuildType
knownBuildTypes :: [BuildType]
knownBuildTypes = [Simple, Configure, Make, Custom]
instance Pretty BuildType where
pretty (UnknownBuildType other) = Disp.text other
pretty other = Disp.text (show other)
instance Parsec BuildType where
parsec = do
name <- P.munch1 isAlphaNum
return $ case name of
"Simple" -> Simple
"Configure" -> Configure
"Custom" -> Custom
"Make" -> Make
_ -> UnknownBuildType name
instance Text BuildType where
parse = do
name <- Parse.munch1 isAlphaNum
return $ case name of
"Simple" -> Simple
"Configure" -> Configure
"Custom" -> Custom
"Make" -> Make
_ -> UnknownBuildType name