Skip to content

Commit 1746567

Browse files
committed
Prettify Haskell types in eldoc support.
Replaces some substrings like "::" with Unicode characters.
1 parent 2c289a7 commit 1746567

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

haskell-customize.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ a per-project basis."
7777
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7878
;; Configuration
7979

80+
(defcustom haskell-doc-prettify-types t
81+
"Replace some parts of types with Unicode characters like \"\"
82+
when showing type information about symbols."
83+
:group 'haskell-doc
84+
:type 'boolean
85+
:safe 'booleanp)
86+
8087
(defvar haskell-process-end-hook nil
8188
"Hook for when the haskell process ends.")
8289

haskell-doc.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,11 @@ CALLBACK will be called with a formatted type string."
16481648
(type (propertize
16491649
(substring response (match-end 0))
16501650
'face 'eldoc-highlight-function-argument)))
1651-
(setq response (concat name type))))))
1651+
(setq response (concat name type)))))
1652+
(when haskell-doc-prettify-types
1653+
(dolist (re '(("::" . "") ("=>" . "") ("->" . "")))
1654+
(setq response
1655+
(replace-regexp-in-string (car re) (cdr re) response)))))
16521656
(when callback (funcall callback response))))))))
16531657

16541658
(defun haskell-doc-sym-doc (sym)

0 commit comments

Comments
 (0)