getHintOpts :: [String] -> [String]
getHintOpts args = removeBad opts
  where
    --------------------------------------------------------------------------
    bad       = ["-threaded", "-O", "-main-is", "-o", "--make", "-static", "-XHaskell", "-ddump-hi"]

    --------------------------------------------------------------------------
    removeBad = filter (\x -> not $ any (`isPrefixOf` x) bad)

    --------------------------------------------------------------------------
    hideAll   = filter (== "-hide-all-packages") args

    --------------------------------------------------------------------------
    srcOpts   = filter (\x -> "-i" `isPrefixOf` x) args

    --------------------------------------------------------------------------
    toCopy    = filter (not . isSuffixOf ".hs") $
                dropWhile (not . ("-package" `isPrefixOf`)) args

    --------------------------------------------------------------------------
    copy      = map (intercalate " ")
                    . groupBy (\_ s -> not $ "-" `isPrefixOf` s)

    --------------------------------------------------------------------------
    opts      = concat [hideAll, srcOpts, copy toCopy]


------------------------------------------------------------------------------
-- | This function extracts the source paths from the compilation args
getHintOpts :: [String] -> [String]
getHintOpts args = removeBad opts
  where
    --------------------------------------------------------------------------
    bad       = ["-threaded", "-O", "-main-is", "-o", "--make", "-static", "-XHaskell", "-ddump-hi"]

    --------------------------------------------------------------------------
    removeBad = filter (\x -> not $ any (`isPrefixOf` x) bad)

    --------------------------------------------------------------------------
    hideAll   = filter (== "-hide-all-packages") args

    --------------------------------------------------------------------------
    srcOpts   = filter (\x -> "-i" `isPrefixOf` x) args

    --------------------------------------------------------------------------
    toCopy    = filter (not . isSuffixOf ".hs") $
                dropWhile (not . ("-package" `isPrefixOf`)) args

    --------------------------------------------------------------------------
    copy      = map (intercalate " ")
                    . groupBy (\_ s -> not $ "-" `isPrefixOf` s)

    --------------------------------------------------------------------------
    opts      = concat [hideAll, srcOpts, copy toCopy]


------------------------------------------------------------------------------
-- | This function extracts the source paths from the compilation args
getHintOpts args = removeBad opts
  where
    --------------------------------------------------------------------------
    bad       = ["-threaded", "-O", "-main-is", "-o", "--make", "-static", "-XHaskell", "-ddump-hi"]

    --------------------------------------------------------------------------
    removeBad = filter (\x -> not $ any (`isPrefixOf` x) bad)

    --------------------------------------------------------------------------
    hideAll   = filter (== "-hide-all-packages") args

    --------------------------------------------------------------------------
    srcOpts   = filter (\x -> "-i" `isPrefixOf` x) args

    --------------------------------------------------------------------------
    toCopy    = filter (not . isSuffixOf ".hs") $
                dropWhile (not . ("-package" `isPrefixOf`)) args

    --------------------------------------------------------------------------
    copy      = map (intercalate " ")
                    . groupBy (\_ s -> not $ "-" `isPrefixOf` s)

    --------------------------------------------------------------------------
    opts      = concat [hideAll, srcOpts, copy toCopy]


------------------------------------------------------------------------------
-- | This function extracts the source paths from the compilation args