{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
module Distribution.Types.BuildType (
BuildType(..),
knownBuildTypes,
) where
import Prelude ()
import Distribution.Compat.Prelude
import Distribution.Text
import qualified Distribution.Compat.ReadP as Parse
import 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 Text BuildType where
disp (UnknownBuildType other) = Disp.text other
disp other = Disp.text (show other)
parse = do
name <- Parse.munch1 isAlphaNum
return $ case name of
"Simple" -> Simple
"Configure" -> Configure
"Custom" -> Custom
"Make" -> Make
_ -> UnknownBuildType name