mkGetoptTH :: [OptDesc] -- ^ options set
           -> String    -- ^ name of fn to generate (getoptsx above)
           -> ArgArity                         -- ^ arity of arguments
           -> String                           -- ^ arg type (for help text)
           -> Q [Dec]

mkGetoptTH optdescs getoptName arity argtype = do
  typeSig <- mkGetoptTHTypeSig (ov_typename getoptName)
  eff     <- mkEffector optdescs getoptName
  let getopt_th = mk_getopt_th typeSig getoptName arity argtype
  return $ eff ++ getopt_th


-- mkEffector ------------------------------------------------------------------

{- | create effector, including type sig

      getoptsx_effect pclv = do
        ((string_x', incr_x', handle_x'), exs) <- runWriterT $ do
                string_x    <- tryWriteF $
                                 return (((fromMaybe "") . (view s___)) pclv);
                incr_x      <- tryWriteF $ return (view incr___ pclv)
                handle_x    <- tryWriteF $
                                 openFileRO (((fromMaybe "/etc/motd")
                                              . (view handle___)) pclv)
                return (string_x, incr_x, handle_x)
        return $ if null exs
                 then Right $ Getoptsx (fromJust string_x')
                                       (fromJust incr_x')
                                       (fromJust handle_x')
                 else Left exs

      above)
 -}
mkGetoptTH :: [OptDesc] -- ^ options set
           -> String    -- ^ name of fn to generate (getoptsx above)
           -> ArgArity                         -- ^ arity of arguments
           -> String                           -- ^ arg type (for help text)
           -> Q [Dec]
mkGetoptTH optdescs getoptName arity argtype = do
  typeSig <- mkGetoptTHTypeSig (ov_typename getoptName)
  eff     <- mkEffector optdescs getoptName
  let getopt_th = mk_getopt_th typeSig getoptName arity argtype
  return $ eff ++ getopt_th


-- mkEffector ------------------------------------------------------------------

{- | create effector, including type sig

      getoptsx_effect pclv = do
        ((string_x', incr_x', handle_x'), exs) <- runWriterT $ do
                string_x    <- tryWriteF $
                                 return (((fromMaybe "") . (view s___)) pclv);
                incr_x      <- tryWriteF $ return (view incr___ pclv)
                handle_x    <- tryWriteF $
                                 openFileRO (((fromMaybe "/etc/motd")
                                              . (view handle___)) pclv)
                return (string_x, incr_x, handle_x)
        return $ if null exs
                 then Right $ Getoptsx (fromJust string_x')
                                       (fromJust incr_x')
                                       (fromJust handle_x')
                 else Left exs

      above)
 -}
mkGetoptTH optdescs getoptName arity argtype = do
  typeSig <- mkGetoptTHTypeSig (ov_typename getoptName)
  eff     <- mkEffector optdescs getoptName
  let getopt_th = mk_getopt_th typeSig getoptName arity argtype
  return $ eff ++ getopt_th


-- mkEffector ------------------------------------------------------------------

{- | create effector, including type sig

      getoptsx_effect pclv = do
        ((string_x', incr_x', handle_x'), exs) <- runWriterT $ do
                string_x    <- tryWriteF $
                                 return (((fromMaybe "") . (view s___)) pclv);
                incr_x      <- tryWriteF $ return (view incr___ pclv)
                handle_x    <- tryWriteF $
                                 openFileRO (((fromMaybe "/etc/motd")
                                              . (view handle___)) pclv)
                return (string_x, incr_x, handle_x)
        return $ if null exs
                 then Right $ Getoptsx (fromJust string_x')
                                       (fromJust incr_x')
                                       (fromJust handle_x')
                 else Left exs

      above)
 -}