-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A modern command-line parser for Haskell. -- @package lambda-options @version 0.1.0.0 module Text.LambdaOptions -- | Class describing parseable values. Much like the Read class. class Parseable a parse :: Parseable a => String -> Maybe a -- | An option keyword, such as "--help" -- -- NB: In the future, this will become a proper data type that contains a -- list of aliases and help descriptions. type Keyword = String -- | The callback to be called for a successfully parsed option. -- -- This function (or value) can have any arity and ultimately returns a -- value with type Monad m => m () -- -- Each of the callback's arguments must have a type t which -- implements Parseable. -- -- Example callbacks: -- --
--   putStrLn "Option parsed!" :: IO ()
--   put :: String -> State ()
--   \n -> liftIO (print n) :: (MonadIO m) => Int -> m ()
--   \n s f -> lift (print (n, s, f)) :: (MonadTrans m) => Int -> String -> Float -> m IO ()
--   
type OptionCallback m f = (Monad m, GetOpaqueParsers f, WrapCallback m f) -- | A monad transformer for parsing options. data Options m a -- | Contains information about what went wrong during an unsuccessful -- parse. data OptionsError -- | NB: In the future, there will be more informative constructors. OptionsError :: OptionsError -- | Adds the following option into the monadic context. addOption :: OptionCallback m f => Keyword -> f -> Options m () -- | Tries to parse the supplied options against input arguments. If -- successful, parsed option callbacks are executed. runOptions :: Monad m => Options m a -> [String] -> m (Maybe OptionsError) instance (Monad m, Functor m) => Applicative (Options m) instance Functor m => Functor (Options m) instance Monad m => Monad (Options m) instance Monad m => MonadState (OptionsState m) (Options m) instance MonadIO m => MonadIO (Options m) instance Show OptionsError instance MonadTrans Options instance (Typeable a, WrapCallback m b) => WrapCallback m (a -> b) instance WrapCallback m (m ()) instance Monad m => GetOpaqueParsers (m ()) instance (Parseable a, Typeable a, GetOpaqueParsers b) => GetOpaqueParsers (a -> b) instance Parseable Float instance Parseable String instance Parseable Int