optArg :: (Opt -> Command) -> String -> IP.IdrisParser (Either String Command)
optArg cmd name = do
    let emptyArgs = do
            P.eof
            return $ Left ("Usage is :" ++ name ++ " <option>")

    let oneArg = do
          o <- pOption
          IP.whiteSpace
          P.eof
          return (Right (cmd o))

    let failure = return $ Left "Unrecognized setting"

    P.try emptyArgs <|> oneArg <|> failure

    where
        pOption :: IP.IdrisParser Opt
        pOption = foldl (<|>) empty $ map (\(a, b) -> do discard (IP.symbol a); return b) setOptions
optArg :: (Opt -> Command) -> String -> IP.IdrisParser (Either String Command)
optArg cmd name = do
    let emptyArgs = do
            P.eof
            return $ Left ("Usage is :" ++ name ++ " <option>")

    let oneArg = do
          o <- pOption
          IP.whiteSpace
          P.eof
          return (Right (cmd o))

    let failure = return $ Left "Unrecognized setting"

    P.try emptyArgs <|> oneArg <|> failure

    where
        pOption :: IP.IdrisParser Opt
        pOption = foldl (<|>) empty $ map (\(a, b) -> do discard (IP.symbol a); return b) setOptions
optArg cmd name = do
    let emptyArgs = do
            P.eof
            return $ Left ("Usage is :" ++ name ++ " <option>")

    let oneArg = do
          o <- pOption
          IP.whiteSpace
          P.eof
          return (Right (cmd o))

    let failure = return $ Left "Unrecognized setting"

    P.try emptyArgs <|> oneArg <|> failure

    where
        pOption :: IP.IdrisParser Opt
        pOption = foldl (<|>) empty $ map (\(a, b) -> do discard (IP.symbol a); return b) setOptions