module HaskellCI.Config.PackageScope 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 PackageScope
    = PackageScopeNone
    | PackageScopeLocal
    | PackageScopeAll
  deriving (PackageScope -> PackageScope -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PackageScope -> PackageScope -> Bool
$c/= :: PackageScope -> PackageScope -> Bool
== :: PackageScope -> PackageScope -> Bool
$c== :: PackageScope -> PackageScope -> Bool
Eq, Int -> PackageScope -> ShowS
[PackageScope] -> ShowS
PackageScope -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PackageScope] -> ShowS
$cshowList :: [PackageScope] -> ShowS
show :: PackageScope -> String
$cshow :: PackageScope -> String
showsPrec :: Int -> PackageScope -> ShowS
$cshowsPrec :: Int -> PackageScope -> ShowS
Show)

instance C.Parsec PackageScope where
    parsec :: forall (m :: * -> *). CabalParsing m => m PackageScope
parsec = 
            PackageScope
PackageScopeNone  forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ forall (m :: * -> *). CharParsing m => String -> m String
C.string String
"none"
        forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> PackageScope
PackageScopeLocal forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ forall (m :: * -> *). CharParsing m => String -> m String
C.string String
"local"
        forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> PackageScope
PackageScopeAll   forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ forall (m :: * -> *). CharParsing m => String -> m String
C.string String
"all"

instance C.Pretty PackageScope where
    pretty :: PackageScope -> Doc
pretty PackageScope
PackageScopeNone  = String -> Doc
PP.text String
"none"
    pretty PackageScope
PackageScopeLocal = String -> Doc
PP.text String
"local"
    pretty PackageScope
PackageScopeAll   = String -> Doc
PP.text String
"all"