knupfer / haskell-emacs

Write Emacs extensions in Haskell
376 stars 22 forks source link

Spacemacs + GHC 7.10.3. Lisp error: (void-function Matrix\.identity) #51

Closed y-usuzumi closed 8 years ago

y-usuzumi commented 8 years ago

Hi. I added haskell-emacs, haskell-emacs-base and haskell-emacs-text to the additional-packages list. I ran haskell-emacs-init and answered yes for all questions. Looks fine. The example Matrix compiles. Then I tried to eval (Matrix.identity 3) in the scratch buffer, and got the error:

Debugger entered--Lisp error: (void-function Matrix\.identity)
  (Matrix\.identity 3)
  eval((Matrix\.identity 3) nil)
  eval-last-sexp-1(nil)
  #[257 "\204\303!\207  \303!\n)B\211A    =\204\211A\211@\207" [eval-expression-debug-on-error eval-last-sexp-fake-value debug-on-error eval-last-sexp-1] 4 2422273 "P"](nil)
  #[(&rest _it) "  !\211\207" [ad--addoit-function eval-last-sexp-arg-internal ad-return-value] 2]()
  eval-sexp-fu-flash-doit-simple(#[(&rest _it) "   !\211\207" [ad--addoit-function eval-last-sexp-arg-internal ad-return-value] 2] (closure (t) (&rest args) (apply (quote esf-hl-highlight-bounds) (quote (1 . 20)) (quote eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote esf-hl-unhighlight-bounds) (quote (1 . 20)) (quote #<buffer *scratch*>) args)))
  eval-sexp-fu-flash-doit(#[(&rest _it) "  !\211\207" [ad--addoit-function eval-last-sexp-arg-internal ad-return-value] 2] (closure (t) (&rest args) (apply (quote esf-hl-highlight-bounds) (quote (1 . 20)) (quote eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote esf-hl-unhighlight-bounds) (quote (1 . 20)) (quote #<buffer *scratch*>) args)))
  esf-flash-doit(#[(&rest _it) "   !\211\207" [ad--addoit-function eval-last-sexp-arg-internal ad-return-value] 2] (closure (t) (&rest args) (apply (quote esf-hl-highlight-bounds) (quote (1 . 20)) (quote eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote esf-hl-unhighlight-bounds) (quote (1 . 20)) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote esf-flash-error-bounds) (quote (1 . 20)) (quote #<buffer *scratch*>) (quote eval-sexp-fu-flash-error) args)))
  ad-Advice-eval-last-sexp(#[257 "\204\303!\207 \303!\n)B\211A    =\204\211A\211@\207" [eval-expression-debug-on-error eval-last-sexp-fake-value debug-on-error eval-last-sexp-1] 4 2422273 "P"] nil)
  apply(ad-Advice-eval-last-sexp #[257 "\204\303!\207   \303!\n)B\211A    =\204\211A\211@\207" [eval-expression-debug-on-error eval-last-sexp-fake-value debug-on-error eval-last-sexp-1] 4 2422273 "P"] nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

Did I miss something?

y-usuzumi commented 8 years ago

Sorry, compile is error:

.HaskellEmacs.hs:217:17:
    Constructor ‘EVar’ should have 1 argument, but has been given 2
    In the pattern: EVar _ qname
    In an equation for ‘exportFunction’:
        exportFunction (EVar _ qname) = unQualifiedName qname
y-usuzumi commented 8 years ago

Hi. After a brief look, the issue locates here:

exportFunction :: ExportSpec -> Maybe Name
exportFunction (EVar qname  {- originally (Evar _ qname) -}) = unQualifiedName qname
exportFunction (EModuleContents _) = Nothing
exportFunction _                   = Nothing

according to https://hackage.haskell.org/package/haskell-src-exts-1.17.1/docs/Language-Haskell-Exts-Syntax.html

I'm fairly new to Haskell. Is it due to some recent version bumps of haskell-src-exts that breaks compatibility?

knupfer commented 8 years ago

Yes, it's due to the api change in haskell-src-exts. It's fixed with your PR. Thanks!