findKernelsInternal :: IO Kernelspecs
findKernelsInternal = do
  jupyterPath <- which "jupyter"
  specsE <- eitherDecode . CBS.pack <$> runJupyterCommand jupyterPath
                                          ["kernelspec", "list", "--json"]
  case specsE of
    Left err    -> throwIO $ JupyterKernelspecException $ T.pack err
    Right specs -> return specs


-- | Kernelspecs can refer to files such as kernel.js and logo-64x64.png. Check whether the
-- kernelspec refers to that file; if it does, check that the file exists. If the file doesn't
-- exist, then remove it from the kernelspec.
findKernelsInternal :: IO Kernelspecs
findKernelsInternal = do
  jupyterPath <- which "jupyter"
  specsE <- eitherDecode . CBS.pack <$> runJupyterCommand jupyterPath
                                          ["kernelspec", "list", "--json"]
  case specsE of
    Left err    -> throwIO $ JupyterKernelspecException $ T.pack err
    Right specs -> return specs


-- | Kernelspecs can refer to files such as kernel.js and logo-64x64.png. Check whether the
-- kernelspec refers to that file; if it does, check that the file exists. If the file doesn't
-- exist, then remove it from the kernelspec.
findKernelsInternal = do
  jupyterPath <- which "jupyter"
  specsE <- eitherDecode . CBS.pack <$> runJupyterCommand jupyterPath
                                          ["kernelspec", "list", "--json"]
  case specsE of
    Left err    -> throwIO $ JupyterKernelspecException $ T.pack err
    Right specs -> return specs


-- | Kernelspecs can refer to files such as kernel.js and logo-64x64.png. Check whether the
-- kernelspec refers to that file; if it does, check that the file exists. If the file doesn't
-- exist, then remove it from the kernelspec.