Source directories listed in .cabal file not found when loading interpreter

Arnaud Bailly arnaud.oqube at gmail.com
Mon Apr 21 08:37:26 BST 2014


Hello,

I am having troubles loading files in the interpreter from emacs: It seems that directories listed in .cabal file are not taken into account, which causes the following error:


Import.hs:18:18-28: Could not find module `SharedTypes' …                                                                                                                                                  
    Use -v to see a list of the files searched for.                                                                                                                                                        
Compilation failed.                                                                                                                                                                                        
Prelude| Prelude| Prelude| λ> 


Here is my .cabal file (part of) actually:

library
    hs-source-dirs: ., fay-shared
    exposed-modules: Application
                     Foundation
                     Import
                     Model
                     Settings
                     Settings.StaticFiles
                     Settings.Development
                     SharedTypes
                     Handler.Fay
                     Handler.Home


And here is my .emacs config:

;; haskell coding                                                                                                                                                                                          
(require 'auto-complete)
(require 'haskell-mode)
(require 'haskell-cabal)

;; display current function in the status bar                                                                                                                                                              
(require 'which-func)

(eval-after-load "which-func"
  '(add-to-list 'which-func-modes 'haskell-mode))

;; "advanced" haskell indentation mode                                                                                                                                                                     
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)

;; scan top-level declarations in the current file                                                                                                                                                         
;; provide shortcuts to move to beginning/end of a declaration and to select it                                                                                                                            
;; C-M-a -> begin                                                                                                                                                                                          
;; C-M-e -> end                                                                                                                                                                                            
;; C-M-h -> select                                                                                                                                                                                         
(add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan)

;; support for ghc-mod: http://www.mew.org/~kazu/proj/ghc-mod/en/preparation.html                                                                                                                          
;;(autoload 'ghc-init "ghc" nil t)                                                                                                                                                                         
;;(add-hook 'haskell-mode-hook (lambda () (ghc-init)))                                                                                                                                                     

(eval-after-load "haskell-mode"
  '(progn
     ;; reformat source code using stylish-haskell                                                                                                                                                         
     ;; https://github.com/jaspervdj/stylish-haskell                                                                                                                                                       
     (setq haskell-stylish-on-save t)

     ;; display fancy symbols                                                                                                                                                                              
     (setq haskell-font-lock-symbols t)

     ;; increase/decrease indentations of blocks                                                                                                                                                           
     (define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left)
     (define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right)
     ;; activates haskell interactive mode: http://haskell.github.io/haskell-mode/manual/latest/#haskell_002dinteractive_002dmode                                                                           
     (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)

     ;; activates auto-completion for haskell buffers                                                                                                                                                      
     ;; Do this to get a variable in scope                                                                                                                                                                 
     (auto-complete-mode)

     ;; from http://pastebin.com/tJyyEBAS                                                                                                                                                                  
     (ac-define-source ghc-mod
       '((depends ghc)
         (candidates . (ghc-select-completion-symbol))
         (symbol . "s")
         (cache)))

     (defun my-ac-haskell-mode ()
       (setq ac-sources '(ac-source-words-in-same-mode-buffers
                          ac-source-dictionary
                          ac-source-ghc-mod)))
     (add-hook 'haskell-mode-hook 'my-ac-haskell-mode)


     (defun my-haskell-ac-init ()
       (when (member (file-name-extension buffer-file-name) '("hs" "lhs"))
         (auto-complete-mode t)
         (setq ac-sources '(ac-source-words-in-same-mode-buffers
                            ac-source-dictionary
                            ac-source-ghc-mod))))
     (add-hook 'find-file-hook 'my-haskell-ac-init)
     ))

(eval-after-load "haskell-cabal"
    '(define-key haskell-cabal-mode-map (kbd "C-c C-c") 'haskell-compile))


Help greatly appreciated! 

Thanks

Arnaud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://projects.haskell.org/pipermail/haskellmode-emacs/attachments/20140421/8792675c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://projects.haskell.org/pipermail/haskellmode-emacs/attachments/20140421/8792675c/attachment-0001.pgp>


More information about the Haskellmode-emacs mailing list