File tree Expand file tree Collapse file tree 3 files changed +38
-3
lines changed Expand file tree Collapse file tree 3 files changed +38
-3
lines changed Original file line number Diff line number Diff line change @@ -258,9 +258,15 @@ Read C-h f haskell-emacs-init for more instructions")
258
258
" Take XS and remove recursively all text properties."
259
259
(if (stringp xs)
260
260
(substring-no-properties xs)
261
- (if (listp xs)
262
- (mapcar 'haskell-emacs--no-properties xs)
263
- xs)))
261
+ (if (ring-p xs)
262
+ (haskell-emacs--no-properties (ring-elements xs))
263
+ (if (or (listp xs) (vectorp xs) (bool-vector-p xs))
264
+ (mapcar 'haskell-emacs--no-properties xs)
265
+ (if (hash-table-p xs)
266
+ (let ((pairs))
267
+ (maphash (lambda (k v ) (push (list k v) pairs)) xs)
268
+ (haskell-emacs--no-properties pairs))
269
+ xs)))))
264
270
265
271
(defun haskell-emacs--fun-wrapper (fun args docs )
266
272
" Take FUN with ARGS and return wrappers in elisp with the DOCS."
Original file line number Diff line number Diff line change 3
3
module HaskellEmacsTest where
4
4
5
5
import Control.Monad
6
+ import Data.Char
6
7
import qualified Data.Text as T
7
8
import External.NBody
8
9
import Foreign.Emacs
@@ -56,6 +57,17 @@ allTrue = and
56
57
anyTrue :: [Bool ] -> Bool
57
58
anyTrue = or
58
59
60
+ -- Char
61
+
62
+ nextChar :: Char -> Char
63
+ nextChar = chr . succ . ord
64
+
65
+ -- Lisp
66
+
67
+ symbolReverse :: Lisp -> Lisp
68
+ symbolReverse (Symbol s) = Symbol $ T. reverse s
69
+ symbolReverse x = x
70
+
59
71
-- Num
60
72
61
73
nextNum :: Int -> Int
Original file line number Diff line number Diff line change 75
75
((HaskellEmacsTest.concatFst '((" a" 1 ) (" b" 2 ) (" c" 3 ))) " abc" )
76
76
((HaskellEmacsTest.longAnswer 2 ) " aaaa" )
77
77
((HaskellEmacsTest.nthFib 10 ) 55 )
78
+ ; ;;; Supported types, look at #38
79
+ ((HaskellEmacsTest.nextNum 7 ) 8 )
80
+ ((HaskellEmacsTest.multiply 4.5 2.0 ) 9.0 )
81
+ ((HaskellEmacsTest.nextChar " a" ) " b" )
82
+ ((HaskellEmacsTest.symbolReverse 'abcd ) dcba)
83
+ ((HaskellEmacsTest.summation [1 2 3]) 6 )
84
+ ((HaskellEmacsTest.allTrue (make-bool-vector 3 t )) t )
85
+ ((HaskellEmacsTest.summation (let ((r (make-ring 5 )))
86
+ (ring-insert r 1 )
87
+ (ring-insert r 2 )
88
+ r)) 3 )
89
+ ((HaskellEmacsTest.concatFst (let ((h (make-hash-table )))
90
+ (puthash " c" 12 h)
91
+ (puthash " b" 17 h)
92
+ (puthash " a" 22 h)
93
+ h)) " abc" )
94
+ ; ;;;
78
95
((mapcar 'eval (list (HaskellEmacsTest.multiply-async 2 4 )
79
96
(HaskellEmacsTest.multiply-async 1 9 )
80
97
(HaskellEmacsTest.multiply-async 10 15 )))
You can’t perform that action at this time.
0 commit comments