1 {-# LANGUAGE DeriveDataTypeable #-}
2 {-# LANGUAGE DeriveGeneric #-}
3 {-# LANGUAGE OverloadedStrings #-}
5 module Distribution
.Types
.ExecutableScope
9 import Distribution
.Compat
.Prelude
12 import Distribution
.Parsec
13 import Distribution
.Pretty
15 import qualified Distribution
.Compat
.CharParsing
as P
16 import qualified Text
.PrettyPrint
as Disp
21 deriving (Generic
, Show, Read, Eq
, Ord
, Typeable
, Data
)
23 instance Pretty ExecutableScope
where
24 pretty ExecutablePublic
= Disp
.text
"public"
25 pretty ExecutablePrivate
= Disp
.text
"private"
27 instance Parsec ExecutableScope
where
28 parsec
= P
.try pub
<|
> pri
30 pub
= ExecutablePublic
<$ P
.string "public"
31 pri
= ExecutablePrivate
<$ P
.string "private"
33 instance Binary ExecutableScope
34 instance Structured ExecutableScope
35 instance NFData ExecutableScope
where rnf
= genericRnf
37 -- | 'Any' like semigroup, where 'ExecutablePrivate' is 'Any True'
38 instance Semigroup ExecutableScope
where
39 ExecutablePublic
<> x
= x
40 x
@ExecutablePrivate
<> _
= x
42 -- | 'mempty' = 'ExecutablePublic'
43 instance Monoid ExecutableScope
where
44 mempty
= ExecutablePublic