 Config         -- ^ Pointer to the 'Config' for access to the @categories@.
              -> Category       -- ^ The current 'Category' to check.
              -> [Category]     -- ^ The previous 'Category's for the course.
              -> [Category]     -- ^ The list containing all 'Category's found for the course this far in the right order.
accumCategory Config{..} cat cats = case L.findIndex (any (`T.isPrefixOf` cat)) categories of
    Nothing -> error $ "Unknown category: " ++ show cat
    Just i  -> L.deleteFirstsBy T.isPrefixOf cats (f i) ++ [cat]
  where
    f i = concat $ L.drop i categories


{- | Creates a row for the current 'Table'. The output will differ depending on
    the content in the 'Config' data and the different arguments.

    This function will return the finished row, containing the separating
    'Category's and the correct 'Course' information from the source 'Table'.
-}
toCourse :: Con
accumCategory :: Config         -- ^ Pointer to the 'Config' for access to the @categories@.
              -> Category       -- ^ The current 'Category' to check.
              -> [Category]     -- ^ The previous 'Category's for the course.
              -> [Category]
accumCategory Config{..} cat cats = case L.findIndex (any (`T.isPrefixOf` cat)) categories of
    Nothing -> error $ "Unknown category: " ++ show cat
    Just i  -> L.deleteFirstsBy T.isPrefixOf cats (f i) ++ [cat]
  where
    f i = concat $ L.drop i categories


{- | Creates a row for the current 'Table'. The output will differ depending on
    the content in the 'Config' data and the different arguments.

    This function will return the finished row, containing the separating
    'Category's and the correct 'Course' information from the source 'Table'.
-}
accumCategory Config{..} cat cats = case L.findIndex (any (`T.isPrefixOf` cat)) categories of
    Nothing -> error $ "Unknown category: " ++ show cat
    Just i  -> L.deleteFirstsBy T.isPrefixOf cats (f i) ++ [cat]
  where
    f i = concat $ L.drop i categories


{- | Creates a row for the current 'Table'. The output will differ depending on
    the content in the 'Config' data and the different arguments.

    This function will return the finished row, containing the separating
    'Category's and the correct 'Course' information from the source 'Table'.
-}