mirror of
https://github.com/Gabriella439/optparse-generic.git
synced 2024-11-27 12:34:54 +03:00
Replace Description
with Text
This commit is contained in:
parent
f2cfa34c07
commit
0afe894901
@ -2,7 +2,6 @@
|
|||||||
{-# LANGUAGE DeriveGeneric #-}
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
|
||||||
{-# LANGUAGE TypeOperators #-}
|
{-# LANGUAGE TypeOperators #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
|
|
||||||
@ -40,7 +39,6 @@ import Control.Applicative
|
|||||||
import Control.Monad.IO.Class (MonadIO(..))
|
import Control.Monad.IO.Class (MonadIO(..))
|
||||||
import Data.Char (toUpper)
|
import Data.Char (toUpper)
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
import Data.String (IsString(..))
|
|
||||||
import Data.Text (Text)
|
import Data.Text (Text)
|
||||||
import Data.Typeable (Typeable)
|
import Data.Typeable (Typeable)
|
||||||
import Data.Void (Void)
|
import Data.Void (Void)
|
||||||
@ -225,16 +223,14 @@ instance (Constructor c, GenericParseRecord f) => GenericParseRecord (M1 C c f)
|
|||||||
instance GenericParseRecord f => GenericParseRecord (M1 D c f) where
|
instance GenericParseRecord f => GenericParseRecord (M1 D c f) where
|
||||||
genericParseRecord = fmap M1 (Options.helper <*> genericParseRecord)
|
genericParseRecord = fmap M1 (Options.helper <*> genericParseRecord)
|
||||||
|
|
||||||
{-| A brief description of what your program does
|
-- | Marshal any value that implements `ParseRecord` from the command line
|
||||||
|
getRecord
|
||||||
This description will appear in the header of the @--help@ output
|
:: (MonadIO io, ParseRecord a)
|
||||||
-}
|
=> Text
|
||||||
newtype Description = Description { getDescription :: Text }
|
-- ^ Program description
|
||||||
deriving (IsString)
|
-> io a
|
||||||
|
|
||||||
getRecord :: (MonadIO io, ParseRecord a) => Description -> io a
|
|
||||||
getRecord desc = liftIO (Options.execParser info)
|
getRecord desc = liftIO (Options.execParser info)
|
||||||
where
|
where
|
||||||
header = Options.header (Data.Text.unpack (getDescription desc))
|
header = Options.header (Data.Text.unpack desc)
|
||||||
|
|
||||||
info = Options.info parseRecord header
|
info = Options.info parseRecord header
|
||||||
|
Loading…
Reference in New Issue
Block a user