Function: haskell-ts-compile-region-and-go
haskell-ts-compile-region-and-go is an interactive and natively
compiled function defined in haskell-ts-mode.el.
Signature
(haskell-ts-compile-region-and-go START END)
Documentation
Compile the text from START to END in the haskell proc.
If region is not active, reload the whole file.
Key Bindings
haskell-ts-mode-map C-c C-c
Source Code
;; Defined in /nix/store/84k99g1lc4gz6zw2djcsyzr9zviz842h-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-ts-mode-1.3.5/haskell-ts-mode.el
(defun haskell-ts-compile-region-and-go (start end)
"Compile the text from START to END in the haskell proc.
If region is not active, reload the whole file."
(interactive (if (region-active-p)
(list (region-beginning) (region-end))
(list (point-min) (point-max))))
(let ((hs (haskell-ts-haskell-session)))
(if (region-active-p)
(let ((str (buffer-substring-no-properties start end)))
(comint-send-string hs ":{\n")
(comint-send-string
hs
;; Things that may cause problem to ghci need to be
;; escaped. TODO examine if other lines that start with
;; colons might cause problems
(replace-regexp-in-string "^:\\}" "\\:}" str nil t))
(comint-send-string hs "\n:}\n"))
(comint-send-string hs ":r\n"))))