module HaskellCI.Config.Components where
import HaskellCI.Prelude
import qualified Distribution.Compat.CharParsing as C
import qualified Distribution.Parsec as C
import qualified Distribution.Pretty as C
import qualified Text.PrettyPrint as PP
data Components
= ComponentsAll
| ComponentsLibs
deriving (Components -> Components -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Components -> Components -> Bool
$c/= :: Components -> Components -> Bool
== :: Components -> Components -> Bool
$c== :: Components -> Components -> Bool
Eq, Int -> Components -> ShowS
[Components] -> ShowS
Components -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Components] -> ShowS
$cshowList :: [Components] -> ShowS
show :: Components -> String
$cshow :: Components -> String
showsPrec :: Int -> Components -> ShowS
$cshowsPrec :: Int -> Components -> ShowS
Show)
instance C.Pretty Components where
pretty :: Components -> Doc
pretty Components
ComponentsAll = String -> Doc
PP.text String
"all"
pretty Components
ComponentsLibs = String -> Doc
PP.text String
"libs"
instance C.Parsec Components where
parsec :: forall (m :: * -> *). CabalParsing m => m Components
parsec = do
String
t <- forall (m :: * -> *). CabalParsing m => m String
C.parsecToken
case String
t of
String
"all" -> forall (m :: * -> *) a. Monad m => a -> m a
return Components
ComponentsAll
String
"libs" -> forall (m :: * -> *) a. Monad m => a -> m a
return Components
ComponentsLibs
String
_ -> forall (m :: * -> *) a. Parsing m => String -> m a
C.unexpected forall a b. (a -> b) -> a -> b
$ String
"Component " forall a. [a] -> [a] -> [a]
++ String
t