Issue 47 in scion-lib: scion-thing-at-point gives Lisp error: (wrong-type-argument listp "main :: IO ()")

4 views
Skip to first unread message

scio...@googlecode.com

unread,
Dec 13, 2010, 5:27:52 PM12/13/10
to scion-l...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 47 by anders.kaseorg: scion-thing-at-point gives Lisp error:
(wrong-type-argument listp "main :: IO ()")
http://code.google.com/p/scion-lib/issues/detail?id=47

In a simple program:
main = putStrLn "Hello, world!"
pressing C-c C-t gives this Lisp error:

Debugger entered--Lisp error: (wrong-type-argument listp "main :: IO ()")
cadr("main :: IO ()")
(format "%s" (cadr r))
(lambda (r) (format "%s" (cadr r)))("main :: IO ()")
funcall((lambda (r) (format "%s" (cadr r))) "main :: IO ()")
(let ((rslt ...)) (funcall (lambda ... ...) rslt))
(message (let (...) (funcall ... rslt)))
(let ((filename ...) (line ...) (col ...)) (message (let ... ...)))
scion-thing-at-point()
call-interactively(scion-thing-at-point nil nil)

I’m using Emacs 23.2+1-4ubuntu2 on Ubuntu 11.04.

scio...@googlecode.com

unread,
May 16, 2011, 2:38:41 AM5/16/11
to scion-l...@googlegroups.com

Comment #1 on issue 47 by anders.kaseorg: scion-thing-at-point gives Lisp
error: (wrong-type-argument listp "main :: IO ()")
http://code.google.com/p/scion-lib/issues/detail?id=47

Looking at this more carefully, I think the problem was commit
897ec92f2ef81b802e1d975d61cc5b3c2fd29f94 “compatibility with AttoJSON
0.5.8”, in which the instance for JSON (Maybe a) was commented out:

instance (JSON a)=>JSON (Maybe a) where
toJSON (Nothing)=Dic.makeObject [(Dic.nothingC,JSNull)]
toJSON (Just a)=Dic.makeObject [(Dic.justC,toJSON a)]
fromJSON _ = fail "Maybe"

in favor of AttoJSON’s new instance:

instance JSON a => JSON (Maybe a) where
fromJSON JSNull = Just Nothing
fromJSON jso = fromJSON jso
toJSON (Just a) = toJSON a
toJSON Nothing = JSNull

This is an incompatible change in the wire protocol.

(AttoJSON’s instance actually kinda sucks, because for example
toJSON (Nothing :: Maybe (Maybe ())) == toJSON (Just Nothing :: Maybe
(Maybe ()))
.)

scio...@googlecode.com

unread,
May 16, 2011, 3:13:57 AM5/16/11
to scion-l...@googlegroups.com

Comment #2 on issue 47 by anders.kaseorg: scion-thing-at-point gives Lisp
error: (wrong-type-argument listp "main :: IO ()")
http://code.google.com/p/scion-lib/issues/detail?id=47

By experimentally removing instance JSON (Maybe a) from AttoJSON, I found
that the affected commands are thing-at-point and current-component. The
latter isn’t used by the Emacs interface (but maybe the Vim interface needs
changes).

Here’s simple patch that fixes the Emacs interface to understand this
protocol change.

Attachments:
0001-Emacs-interface-fix-thing-at-point-47.patch 1.1 KB

Reply all
Reply to author
Forward
0 new messages