Skip to content

Instantly share code, notes, and snippets.

@krisajenkins
Last active August 29, 2015 14:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisajenkins/c927e666ee50e295da08 to your computer and use it in GitHub Desktop.
Save krisajenkins/c927e666ee50e295da08 to your computer and use it in GitHub Desktop.
(require 'cl-lib)
(defun haskell-process-completions-at-point ()
"A company-mode-compatible complete-at-point function."
(interactive)
(destructuring-bind (start . end) (bounds-of-thing-at-point 'symbol)
(let ((completions (haskell-process-get-repl-completions (haskell-process)
(symbol-name (symbol-at-point)))))
(list start end completions))))
(defun haskell-run-main ()
(interactive)
(save-current-buffer)
(inferior-haskell-load-file)
(comint-send-string (get-buffer-process "*haskell*")
"main\n"))
(defun haskell-process-run-main ()
(interactive)
(haskell-process-send-string (haskell-process)
"main\n"))
(add-to-list 'load-path (expand-file-name "~/Work/ThirdParty/structured-haskell-mode/elisp"))
(require 'shm)
(setq haskell-hoogle-command ":search"
haskell-process-path-cabal "~/.cabal/bin/cabal"
haskell-stylish-on-save t
haskell-process-suggest-hoogle-imports t
haskell-process-suggest-remove-import-lines t
haskell-process-type 'cabal-repl
haskell-program-name "ghci"
hindent-style "chris-done"
haskell-tags-on-save t)
(add-hook 'haskell-mode-hook
(lambda ()
(smartparens-strict-mode 0)
(add-to-list 'completion-at-point-functions
'haskell-process-completions-at-point)
(turn-on-haskell-indentation)
(turn-on-haskell-doc-mode)
(flycheck-mode 1)
(cua-selection-mode nil)
(structured-haskell-mode t)))
(eval-after-load "haskell-mode"
'(progn
(define-key haskell-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
(define-key haskell-mode-map (kbd "C-x C-d") nil)
(define-key haskell-mode-map (kbd "C-c C-z") 'haskell-interactive-switch)
(define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-file)
(define-key haskell-mode-map (kbd "C-c C-b") 'haskell-interactive-switch)
(define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
(define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
(define-key haskell-mode-map (kbd "C-c M-.") nil)
(define-key haskell-mode-map (kbd "C-c C-d") nil)
(define-key haskell-mode-map (kbd "M-Q") 'hindent/reformat-decl)
(define-key haskell-mode-map (kbd "M-e") 'haskell-process-reload-file)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment