enum_opt :: (Bounded a,Enum a) => [T.Text] -> (a->T.Text) -> a -> OptEnum -> Opt a
enum_opt hp shw x0 ce =
    Opt
        { opt_enum    = ce
        , opt_default = x0
        , opt_from    = frm
        , opt_to      = String . shw
        , opt_help    = Help hp typ
       }
  where
    frm v =
        case v of
          String s | Just x <- Map.lookup s mp -> x
          _                                    -> x0

    mp    = Map.fromList [ (shw v,v) | v<-[minBound..maxBound] ]

    typ   = T.intercalate "|" $ map shw [minBound..maxBound]
enum_opt :: (Bounded a,Enum a) => [T.Text] -> (a->T.Text) -> a -> OptEnum -> Opt a
enum_opt hp shw x0 ce =
    Opt
        { opt_enum    = ce
        , opt_default = x0
        , opt_from    = frm
        , opt_to      = String . shw
        , opt_help    = Help hp typ
       }
  where
    frm v =
        case v of
          String s | Just x <- Map.lookup s mp -> x
          _                                    -> x0

    mp    = Map.fromList [ (shw v,v) | v<-[minBound..maxBound] ]

    typ   = T.intercalate "|" $ map shw [minBound..maxBound]
enum_opt hp shw x0 ce =
    Opt
        { opt_enum    = ce
        , opt_default = x0
        , opt_from    = frm
        , opt_to      = String . shw
        , opt_help    = Help hp typ
       }
  where
    frm v =
        case v of
          String s | Just x <- Map.lookup s mp -> x
          _                                    -> x0

    mp    = Map.fromList [ (shw v,v) | v<-[minBound..maxBound] ]

    typ   = T.intercalate "|" $ map shw [minBound..maxBound]