Skip to content

Instantly share code, notes, and snippets.

@smoge
Created March 18, 2024 16:11
Show Gist options
  • Save smoge/c2ea8597cb37af9b1f56aea65ea33976 to your computer and use it in GitHub Desktop.
Save smoge/c2ea8597cb37af9b1f56aea65ea33976 to your computer and use it in GitHub Desktop.
haskell-interactive-ext.el
(require 'haskell-interactive-mode)
;; add to .ghci
;; :set +m
(defun haskell-interactive-my-eval ()
"Evaluate the current line or region in the Haskell REPL."
(interactive)
(if (use-region-p)
(progn
(kill-ring-save (region-beginning) (region-end))
(pulse-momentary-highlight-region (region-beginning) (region-end))
(haskell-interactive-switch)
(yank)
(haskell-interactive-mode-return)
(haskell-interactive-switch-back))
(progn
(kill-ring-save (line-beginning-position) (line-end-position))
(pulse-momentary-highlight-region (line-beginning-position) (line-end-position))
(haskell-interactive-switch)
(yank)
(haskell-interactive-mode-return)
(haskell-interactive-switch-back))))
(define-key haskell-mode-map (kbd "S-<return>") 'haskell-interactive-my-eval)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment