cmd_cats :: String -> IP.IdrisParser (Either String Command)
cmd_cats name = do
    cs <- P.sepBy pLogCats (IP.whiteSpace)
    P.eof
    return $ Right $ LogCategory (concat cs)
  where
    badCat = do
      c <- IP.identifier
      fail $ "Category: " ++ c ++ " is not recognised."

    pLogCats :: IP.IdrisParser [LogCat]
    pLogCats = P.try (parserCats  <$ IP.symbol (strLogCat IParse))
           <|> P.try (elabCats    <$ IP.symbol (strLogCat IElab))
           <|> P.try (codegenCats <$ IP.symbol (strLogCat ICodeGen))
           <|> P.try ([ICoverage] <$ IP.symbol (strLogCat ICoverage))
           <|> P.try ([IIBC]      <$ IP.symbol (strLogCat IIBC))
           <|> P.try ([IErasure]  <$ IP.symbol (strLogCat IErasure))
           <|> badCat
cmd_cats :: String -> IP.IdrisParser (Either String Command)
cmd_cats name = do
    cs <- P.sepBy pLogCats (IP.whiteSpace)
    P.eof
    return $ Right $ LogCategory (concat cs)
  where
    badCat = do
      c <- IP.identifier
      fail $ "Category: " ++ c ++ " is not recognised."

    pLogCats :: IP.IdrisParser [LogCat]
    pLogCats = P.try (parserCats  <$ IP.symbol (strLogCat IParse))
           <|> P.try (elabCats    <$ IP.symbol (strLogCat IElab))
           <|> P.try (codegenCats <$ IP.symbol (strLogCat ICodeGen))
           <|> P.try ([ICoverage] <$ IP.symbol (strLogCat ICoverage))
           <|> P.try ([IIBC]      <$ IP.symbol (strLogCat IIBC))
           <|> P.try ([IErasure]  <$ IP.symbol (strLogCat IErasure))
           <|> badCat
cmd_cats name = do
    cs <- P.sepBy pLogCats (IP.whiteSpace)
    P.eof
    return $ Right $ LogCategory (concat cs)
  where
    badCat = do
      c <- IP.identifier
      fail $ "Category: " ++ c ++ " is not recognised."

    pLogCats :: IP.IdrisParser [LogCat]
    pLogCats = P.try (parserCats  <$ IP.symbol (strLogCat IParse))
           <|> P.try (elabCats    <$ IP.symbol (strLogCat IElab))
           <|> P.try (codegenCats <$ IP.symbol (strLogCat ICodeGen))
           <|> P.try ([ICoverage] <$ IP.symbol (strLogCat ICoverage))
           <|> P.try ([IIBC]      <$ IP.symbol (strLogCat IIBC))
           <|> P.try ([IErasure]  <$ IP.symbol (strLogCat IErasure))
           <|> badCat