mirror of
https://github.com/zoriya/applicative-getopt.git
synced 2025-12-06 05:36:09 +00:00
21 lines
486 B
Haskell
21 lines
486 B
Haskell
module GetOpt.Data (
|
|
OptionParser,
|
|
Option(..)
|
|
) where
|
|
|
|
type OptionParser a = (String -> Maybe a)
|
|
|
|
data Option a = Option {
|
|
metavar :: String,
|
|
longName :: String,
|
|
shortName :: Char,
|
|
defaultValue :: Maybe a,
|
|
helpMessage :: String,
|
|
unsetValue :: Maybe a,
|
|
parser :: OptionParser a
|
|
}
|
|
|
|
instance Functor Option where
|
|
-- fmap :: (a -> b) -> f a -> f b
|
|
fmap f (Option mv l s dv hm sv p)
|
|
= Option mv l s (fmap f dv) hm (fmap f sv) (fmap f . p) |