never executed always true always false
    1 {-# LANGUAGE FlexibleContexts #-}
    2 
    3 {-# OPTIONS_HADDOCK hide #-}
    4 
    5 module Options.Applicative.Format
    6     (
    7     -- * Types
    8       FormatType (..)
    9 
   10     -- * Applicative Parser
   11     , formatOpt
   12     ) where
   13 
   14 import Prelude
   15 
   16 import Control.Applicative
   17     ( (<|>) )
   18 import Options.Applicative
   19     ( Parser, flag', long )
   20 
   21 
   22 data FormatType = Hex | Bech32
   23     deriving (Eq, Show)
   24 
   25 --
   26 -- Applicative Parser
   27 --
   28 
   29 -- | Parse an 'FormatType' from the command-line, if there is proper flag then hex is set.
   30 formatOpt :: Parser FormatType
   31 formatOpt = hex <|> pure Bech32
   32   where
   33     hex = flag' Hex (long "hex")