Haskell Debug Adapter for Visual Studio Code.

Latest on Hackage:

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow to host generated Haddocks.

BSD3 licensed by phoityne_hs
Maintained by

Phoityne VSCode

Phoityne is a Haskell GHCi debug adapter for Visual Studio Code.


(This sample project is available from here.)


  • LIMITATION: Source file extension must be ".hs"
  • LIMITATION: Can not use STDIN handle while debugging.
  • When you start debugging for the first time, .vscode/tasks.json will be created automatically. Then you can use F6, F7, F8 shortcut key. F5 : start debug F6 : show command menu (for stack watch) Shift + F6 : stop stack watch F7 : stack clean & build F8 : stack test F9 : put bp on current line * Shift + F9 : put bp on current column
  • While debugging, you can use F5, F9, F10, F11 shortcut key. F5 : jump to next bp F9 : put bp on the line Shift + F9 : put bp on the column F10 : step next * F11 : step into


Run to Cursor


Bindings & Watch

The variable added to watch will be forced.


Stack trace


Break condition


Hit count break condition

Supports these operators. == /= <, > <=, >= mod, % just digit is same with '>='


Break on Exception


Repl & Completions


and more

Better inspection. This is an experimental enhancement.
There are limitations and additional installation.
Here are the details.



  • supportsConfigurationDoneRequest : yes
  • supportsFunctionBreakpoints : yes
  • supportsConditionalBreakpoints : yes
  • supportsHitConditionalBreakpoints : yes
  • supportsEvaluateForHovers : yes
  • exceptionBreakpointFilters : yes
  • supportsStepBack : no
  • supportsSetVariable : no
  • supportsRestartFrame : no
  • supportsGotoTargetsRequest : no
  • supportsStepInTargetsRequest : no
  • supportsCompletionsRequest : yes
  • supportsModulesRequest : no
  • additionalModuleColumns : no
  • supportedChecksumAlgorithms : no
  • supportsRestartRequest : no
  • supportsExceptionOptions : no
  • supportsValueFormattingOptions : no
  • supportsExceptionInfoRequest : no
  • supportTerminateDebuggee : no
  • supportsDelayedStackTraceLoading : no


Run stack install

% stack install phoityne-vscode
  . . . . .

Add 'phoityne-vscode.exe' to PATH environment.


% where $path:phoityne-vscode.exe
C:\Users\[user name]\AppData\Roaming\local\bin\phoityne-vscode.exe

% phoityne-vscode --version
% code


$ which phoityne-vscode
$ phoityne-vscode --version
$ code

Install vscode extensions

  1. run VSCode and open stack project Folder from file menu.
  2. open Extensions from side menu of VSCode.
  3. search "haskell"
  4. select "Haskell GHCi debug adapter Phoityne"



|NAME|REQUIRED OR OPTIONAL|DEFAULT SETTING|DESCRIPTION| |:--|:--:|:--|:--| |startup|required|${workspaceRoot}/test/Spec.hs|debug startup file, will be loaded automatically.| |startupFunc|optional|"" (empty string)|debug startup function, will be run instead of main function.| |startupArgs|optional|"" (empty string)|arguments for startup function. set as string type.| |ghciCmd|required|stack ghci --test --no-load --no-build --main-is TARGET --ghci-options -fprint-evld-with-show|launch ghci command, must be Prelude module loaded. For example, "ghci -i${workspaceRoot}/src", "cabal exec -- ghci -i${workspaceRoot}/src"| |ghciPrompt|required|H>>=|ghci command prompt string.| |ghciInitialPrompt|optional|"Prelude> "|initial pormpt of ghci. set it when using custom prompt. e.g. set in .ghci| |stopOnEntry|required|true|stop or not after debugger launched. |mainArgs|optional|"" (empty string)|main arguments.| |logFile|required|${workspaceRoot}/.vscode/phoityne.log|internal log file.| |logLevel|required|WARNING|internal log level.|

changing ghci initial prompt

If you change ghci prompt in .ghci file, or ghci prompt is changed from "Prelude>" by applying NoImplicitPrelude extension, set the initial prompt variable to same prompt string.

% diff .vscode/launch.json.old .vscode/launch.json
<             "ghciInitialPrompt": "Prelude> "      // default value.
>             "ghciInitialPrompt": "> "             // e.g.

Make sure needs of the last space, and don't forget adding it.

setting the startup hs file

Set the startup variable to the path of .hs file in which main function is defined.

% diff .vscode/launch.json.old .vscode/launch.json
<             "startup": "${workspaceRoot}/test/Spec.hs",    // default value.
>             "startup": "${workspaceRoot}/app/run.hs",     // e.g.

setting the startup function

If you want to run the specific function instead of main function, set the startupFunc variable.
For example, when specifying the following startDebug function,

startDebug :: String -> IO ()
startDebug name = do
  putStrLn "hello"
  putStrLn name 

set the valiavles in the launch.json file.

% diff .vscode/launch.json.old .vscode/launch.json
<             "startupFunc": "",    // default value.
<             "startupArgs": "",    // default value.
>             "startupFunc": "startDebug",       // e.g.
>             "startupArgs": "\"phoityne\"",     // e.g.

changing log level

For debuging phoityen itself, change the log level to DEBUG.
Adding Issue with the debug log.

% diff .vscode/launch.json.old .vscode/launch.json
<             "logLevel": "WARNING",               // default value.
>             "logLevel": "DEBUG",                 // e.g.


|TASK NAME|REQUIRED OR OPTIONAL|DEFAULT SETTING|DESCRIPTION| |:--|:--:|:--|:--| |stack build|required|stack build|task definition for F6 shortcut key.| |stack clean & build|required|stack clean && stack build|task definition for F7 shortcut key.| |stack test|required|stack test|task definition for F8 shortcut key.| |stack watch|required|stack build --test --no-run-tests --file-watch|task definition for F6 shortcut key.|


20180430 phoityne-vscode- * [UPDATE] supported haskell-dap-

20180225 phoityne-vscode- * [UPDATE] supported haskell-dap-

20180211 phoityne-vscode- * [MODIFY] 34 : can not set breakpoint on vscode-1.20.0

20180101 phoityne-vscode- [FIX] clearing frame id while handling stack trace request. [MODIFY] change stack trace size from 20 to 50(max).

20171216 phoityne-vscode- [ADD] checking hackage package version and inform on console if using lower version. [MODIFY] Supporting Multi-root Workspaces. version up tasks.json. * [MODIFY] Supporting Multi-root Workspaces. setBreakpointsRequest.

20171112 phoityne-vscode- [FIX] 29 : Space in filename and reload on save bug. [MODIFY] 20 : During stopping on breakpoints selection is one character less.

20171008 phoityne-vscode- [FIX] loading modules after ghci started, on ghc-8.2.1. [ADD] 24 : add variable "ghciInitialPrompt" to launch.json file. [ADD] 28 : escape backslash of startup hs file path. [ADD] to set any start point, added startup function and arguments valiables in the launch.json file.

20170910 phoityne-vscode- [ADD] supported ghc-8.2.0. [ADD] check hackage phoityen version, and show message for needs of updating.

20170816 phoityne-vscode- [ADD] supported break-on-exception and break-on-error. [ADD] 5 :adding ghci run enviroment variable setting. * [MODIFY] 21 : support evaluateName attribute for watch variable.

20170507 phoityne-vscode- [ADD] 15 : adding main args setting to launch.json [FIX] 16 : Exit on stdin eof

20170402 phoityne-vscode- [FIX] 10 : Unable to set breakpoints [FIX] 11 : Debugger not progressing past IO [ADD] 12 : support Column break points [MODIFY] 6 : adding stopOnEntry setting on launch.json * [MODIFY] : add ghci-options -fprint-evld-with-show to stack run command in launch.json file.

20170205 phoityne-vscode- * [FIX] 8 : Unterminated process after leaving GHCi

20161218 phoityne-vscode- [ADD] Hit count break conditionに対応した。 [FIX] エラー終了時にterminate eventを送信するように修正した。

20161009 phoityne-vscode- [MODIFY] REPL結果をイベントで返すように変更した。EvaluateResponseで返した場合は、複数行表示ができないため。 [MODIFY] REPLにおいて、複数行の入力に対応した。 [MODIFY] REPLにおいて、デバッグ関連のコマンドを実行しないように変更した。 [FIX] バインディング変数情報の取得において、複数行にまたがる情報のパースが失敗していた箇所を修正した。

20160919 phoityne-vscode- [ADD] ConfigurationDoneRequestに対応した。 [ADD] CompletionsRequestに対応した。 [MODIFY] Hover時の型表示を改善した。 [MODIFY] Hover時のforce実行を止めた。 * [FIX] setBreakpointsResponse, setFunctionBreakpointsResponseのBodyデータにおいて、キー名を修正した。

20160804 phoityne-vscode- [MODIFY] モジュール構成の変更。 [MODIFY] debugger adopter interface Capabilitiesの変更に対応した。

20160704 phoityne-vscode- [MODIFY] debugger adopter interface Capabilitiesの変更に対応した。 [MODIFY] debugger adopter interface StackFrameの変更に対応した。(endLin, endColumnの追加) * [MODIFY] debugger adopter interface Variableの変更に対応した。(typeの追加)

20160626 phoityne-vscode-

  • [MODIFY] launchリクエストのghciCmdパラメータで指定したghci起動コマンドを使用するように変更した。
  • [MODIFY] ghciの起動に失敗した場合、デバッグを終了するように修正した。

20160605 phoityne-vscode-

  • [MODIFY] launchリクエストのnoDebugパラメータをMaybeに変更した。

20160601 phoityne-vscode-

  • [MODIFY] スタックトレースの表示を番号から関数名に変更した。
  • [MODIFY] GHC-8.0.1のghciにおいて、:step結果の出力変更(Stopped in)に対応した。

20160515 phoityne-vscode-

  • [ADD] tasks.jsonが存在しない場合は、作成するようにした。
  • [ADD] package.json にキーバインディング設定を追加した。(stack build, stack clean, stack test, stack watch)
  • [ADD] hover requestに対して、:info結果を返すようにした。

20160508 phoityne-vscode-

  • [ADD] デバッガ起動後、ファイル保存時にghciにリロードするようにした。
  • [ADD] 条件付きブレークポイントに対応した。

20160504 phoityne-vscode-

  • [INFO] Initial release.

comments powered byDisqus