module CabalCargs.Sections
( Sections(..)
, Section(..)
, sections
) where
import CabalCargs.Args (Args)
import qualified CabalCargs.Args as A
data Section = Library
| Executable String
| TestSuite String
| Benchmark String
deriving (Show, Eq)
data Sections = AllSections
| Sections [Section]
deriving (Show, Eq)
sections :: Args -> Sections
sections args
| ss@(_:_) <- concat [ [Library | A.library args]
, map Executable (A.executable args)
, map TestSuite (A.testSuite args)
, map Benchmark (A.benchmark args)
]
= Sections ss
| otherwise
= AllSections