knupfer / haskell-emacs

Write Emacs extensions in Haskell
375 stars 22 forks source link

copyFile: permission denied on Windows 10 #58

Open Ninlives opened 8 years ago

Ninlives commented 8 years ago

I tried to compile the example but the function returned: Failed to install HaskellEmacs-0.0.0 Build log ( C:\Users\Eleven\.emacs.d\haskell-fun\.cabal-sandbox\logs\HaskellEmacs-0.0.0.log ): Installing executable(s) in C:\Users\Eleven\.emacs.d\haskell-fun\.cabal-sandbox\bin copyFile: permission denied (access denied)

knupfer commented 8 years ago

Well, I'm not using windows. Could you try to cd into haskell-fun and run cabal build in the terminal? It seems like cabal is choking for some reason.

Ninlives commented 8 years ago

Well cabal build out of the emacs seems to be successful but Matrix.identity is still a void function in emacs.... Debugger entered--Lisp error: (void-function Matrix\.identity)

mwotton commented 8 years ago

Have to run the init function before anything will be accessible from emacs

On Thu, Jul 14, 2016, 10:36 PM Ninlives notifications@github.com wrote:

Well cabal build out of the emacs seems to be successful but Matrix.identity is still a void function in emacs.... Debugger entered--Lisp error: (void-function Matrix.identity)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/knupfer/haskell-emacs/issues/58#issuecomment-232845866, or mute the thread https://github.com/notifications/unsubscribe-auth/AAELgirBSuMLaP6KBbVMbbDkwpDnbJwYks5qVvI3gaJpZM4JMoSv .

Ninlives commented 8 years ago

Seems that the haskell-emacs--compile function was called again after a HaskellEmacs.exe process has been called, and tried to cover the HaskellEmacs.exe file, so the access will be denied..

knupfer commented 8 years ago

Would you mind to test the "refactor" branch?

knupfer commented 8 years ago

And if this results in the same error, could you insert a (sleep-for 1) at the beginning of the definition of haskell-emacs--start-proc?

Ninlives commented 8 years ago

Still have the same problem. And when I restart the emacs(didn't finishi compiling) and rerun it asked me to input lisp expressions

knupfer commented 8 years ago

Hm, this happens when (read foo) is called, where foo = nil. It's quite strange that you get the error of permission denied. The process is explicitly killed before compilations start. Are you sure, that you've added the git repo to your load path and required haskell-emacs and that haskell emacs isn't installed via melpa? It uses some paths of it's own loadpath, so that's quite important.

Could you please run another time into both bugs, but with setting before (setq debug-on-error t) and paste here the output of the two bugs?

Ninlives commented 8 years ago

I deleted the haskell-emacs dirctory in the .emacs.d/elpa directory, should anything else be done? this is the output when I use the refactor branch.

Debugger entered--Lisp error: (error "Writing a default package environment file to
c:\\Users\\Eleven\\.emacs.d\\haskell-fun\\cabal.sandbox.config
Using an existing sandbox located at
C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox
Resolving dependencies...
Notice: installing into a sandbox located at
C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox
Configuring happy-1.19.5...
Building happy-1.19.5...
Installed happy-1.19.5
Resolving dependencies...
Notice: installing into a sandbox located at
C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox
Configuring HaskellEmacs-0.0.0...
Building HaskellEmacs-0.0.0...
Failed to install HaskellEmacs-0.0.0
Build log ( C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\logs\\HaskellEmacs-0.0.0.log ):
Installing executable(s) in
C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\bin
copyFile: permission denied (\276ܾ\370\267\303\316ʡ\243)
acs.Internal ( Foreign\\Emacs\\Internal.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Foreign\\Emacs\\Internal.o )
[2 of 3] Compiling Matrix           ( Matrix.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Matrix.o )
[3 of 3] Compiling Main             ( HaskellEmacs.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Main.o )
Linking dist/dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs.exe ...
cabal: Leaving directory '.'
cabal.exe: Error: some packages failed to install:
HaskellEmacs-0.0.0 failed during the final install step. The exception was:
ExitFailure 1
")
  signal(error ("Writing a default package environment file to\nc:\\Users\\Eleven\\.emacs.d\\haskell-fun\\cabal.sandbox.config\nUsing an existing sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nResolving dependencies...\nNotice: installing into a sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nConfiguring happy-1.19.5...\nBuilding happy-1.19.5...\nInstalled happy-1.19.5\nResolving dependencies...\nNotice: installing into a sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nConfiguring HaskellEmacs-0.0.0...\nBuilding HaskellEmacs-0.0.0...\nFailed to install HaskellEmacs-0.0.0\nBuild log ( C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\logs\\HaskellEmacs-0.0.0.log ):\nInstalling executable(s) in\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\bin\ncopyFile: permission denied (\276ܾ\370\267\303\316ʡ\243)\nacs.Internal ( Foreign\\Emacs\\Internal.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Foreign\\Emacs\\Internal.o )\n[2 of 3] Compiling Matrix           ( Matrix.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Matrix.o )\n[3 of 3] Compiling Main             ( HaskellEmacs.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Main.o )\nLinking dist/dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs.exe ...\ncabal: Leaving directory '.'\ncabal.exe: Error: some packages failed to install:\nHaskellEmacs-0.0.0 failed during the final install step. The exception was:\nExitFailure 1\n"))
  error("Writing a default package environment file to\nc:\\Users\\Eleven\\.emacs.d\\haskell-fun\\cabal.sandbox.config\nUsing an existing sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nResolving dependencies...\nNotice: installing into a sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nConfiguring happy-1.19.5...\nBuilding happy-1.19.5...\nInstalled happy-1.19.5\nResolving dependencies...\nNotice: installing into a sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nConfiguring HaskellEmacs-0.0.0...\nBuilding HaskellEmacs-0.0.0...\nFailed to install HaskellEmacs-0.0.0\nBuild log ( C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\logs\\HaskellEmacs-0.0.0.log ):\nInstalling executable(s) in\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\bin\ncopyFile: permission denied (\276ܾ\370\267\303\316ʡ\243)\nacs.Internal ( Foreign\\Emacs\\Internal.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Foreign\\Emacs\\Internal.o )\n[2 of 3] Compiling Matrix           ( Matrix.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Matrix.o )\n[3 of 3] Compiling Main             ( HaskellEmacs.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Main.o )\nLinking dist/dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs.exe ...\ncabal: Leaving directory '.'\ncabal.exe: Error: some packages failed to install:\nHaskellEmacs-0.0.0 failed during the final install step. The exception was:\nExitFailure 1\n")
  (let ((bug (save-current-buffer (set-buffer heB) (buffer-string)))) (kill-buffer heB) (error bug))
  (if (eql 0 (let ((tool (haskell-emacs--get-build-tool))) (if (eq tool (quote cabal)) (progn (message "Compiling ...") (+ (call-process "cabal" nil heB nil "sandbox" "init") (call-process "cabal" nil heB nil "install" "happy") (call-process "cabal" nil heB nil "install"))) (if (eq tool (quote stack)) (progn (if (file-exists-p ...) nil (let ... ...)) (message "Compiling ...") (+ (call-process "stack" nil heB nil "setup") (call-process "stack" nil heB nil "install"))) (if (eq tool (quote nix)) (progn (if ... nil ...) (message "Compiling ...") (+ ... ...))))))) (kill-buffer heB) (let ((bug (save-current-buffer (set-buffer heB) (buffer-string)))) (kill-buffer heB) (error bug)))
  haskell-emacs--compile-command("*HASKELL-BUFFER*")
  (let* ((heB "*HASKELL-BUFFER*") (heF "HaskellEmacs.hs") (code (concat "-- hash of haskell-emacs: " haskell-emacs--api-hash "\n" "-- hash of all functions: " haskell-emacs--function-hash "\n" code))) (cd haskell-emacs-dir) (if (and (file-exists-p heF) (equal code (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ... ...)))))) nil (insert code) (write-file heF) (mkdir (concat haskell-emacs-dir "Foreign/Emacs/") t) (if (file-exists-p "HaskellEmacs.cabal") nil (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert "\nname:                HaskellEmacs\nversion:             0.0.0\nbuild-type:          Simple\ncabal-version:       >=1.10\nlicense:             GPL-2\nexecutable HaskellEmacs\n  main-is:             HaskellEmacs.hs\n  default-language:    Haskell2010\n  ghc-options:         -O2 -threaded -rtsopts -with-rtsopts=-N\n  build-depends:       base\n                     , atto-lisp\n                     , parallel\n                     , text\n                     , utf8-string\n                     , bytestring\n                     , mtl\n                     , deepseq\n                     , transformers\n                     , atto-lisp\n                     , haskell-src-exts\n                     , containers\n                     , attoparsec") (write-file "HaskellEmacs.cabal")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents (concat ... "Foreign/Emacs.hs")) (write-file "Foreign/Emacs.hs")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents (concat ... "Foreign/Emacs/Internal.hs")) (write-file "Foreign/Emacs/Internal.hs")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) (haskell-emacs--stop-proc) (haskell-emacs--compile-command heB) (haskell-emacs--start-proc))
  (progn (let* ((heB "*HASKELL-BUFFER*") (heF "HaskellEmacs.hs") (code (concat "-- hash of haskell-emacs: " haskell-emacs--api-hash "\n" "-- hash of all functions: " haskell-emacs--function-hash "\n" code))) (cd haskell-emacs-dir) (if (and (file-exists-p heF) (equal code (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...))))) nil (insert code) (write-file heF) (mkdir (concat haskell-emacs-dir "Foreign/Emacs/") t) (if (file-exists-p "HaskellEmacs.cabal") nil (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ... ...))))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents ...) (write-file "Foreign/Emacs.hs")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents ...) (write-file "Foreign/Emacs/Internal.hs")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) (haskell-emacs--stop-proc) (haskell-emacs--compile-command heB) (haskell-emacs--start-proc)))
  (unwind-protect (progn (let* ((heB "*HASKELL-BUFFER*") (heF "HaskellEmacs.hs") (code (concat "-- hash of haskell-emacs: " haskell-emacs--api-hash "\n" "-- hash of all functions: " haskell-emacs--function-hash "\n" code))) (cd haskell-emacs-dir) (if (and (file-exists-p heF) (equal code (let (...) (save-current-buffer ... ...)))) nil (insert code) (write-file heF) (mkdir (concat haskell-emacs-dir "Foreign/Emacs/") t) (if (file-exists-p "HaskellEmacs.cabal") nil (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...)))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ... ...)))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ... ...))))) (haskell-emacs--stop-proc) (haskell-emacs--compile-command heB) (haskell-emacs--start-proc))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (let* ((heB "*HASKELL-BUFFER*") (heF "HaskellEmacs.hs") (code (concat "-- hash of haskell-emacs: " haskell-emacs--api-hash "\n" "-- hash of all functions: " haskell-emacs--function-hash "\n" code))) (cd haskell-emacs-dir) (if (and (file-exists-p heF) (equal code (let ... ...))) nil (insert code) (write-file heF) (mkdir (concat haskell-emacs-dir "Foreign/Emacs/") t) (if (file-exists-p "HaskellEmacs.cabal") nil (let (...) (save-current-buffer ... ...))) (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...))) (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...)))) (haskell-emacs--stop-proc) (haskell-emacs--compile-command heB) (haskell-emacs--start-proc))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (let* ((heB "*HASKELL-BUFFER*") (heF "HaskellEmacs.hs") (code (concat "-- hash of haskell-emacs: " haskell-emacs--api-hash "\n" "-- hash of all functions: " haskell-emacs--function-hash "\n" code))) (cd haskell-emacs-dir) (if (and (file-exists-p heF) (equal code ...)) nil (insert code) (write-file heF) (mkdir (concat haskell-emacs-dir "Foreign/Emacs/") t) (if (file-exists-p "HaskellEmacs.cabal") nil (let ... ...)) (let (...) (save-current-buffer ... ...)) (let (...) (save-current-buffer ... ...))) (haskell-emacs--stop-proc) (haskell-emacs--compile-command heB) (haskell-emacs--start-proc))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  haskell-emacs--compile("{-# LANGUAGE FlexibleInstances #-}\n{-# LANGUAGE OverloadedStrings #-}\n\n-- WARNING: Please note that this file is autogenerated.\n--\n-- If you want to change this file, you have to clone the github repo and apply the changes in a local repo.\n\nmodule Main where\nimport qualified Matrix\n\nimport           Control.Applicative              (optional, (<$>), (<*>))\nimport           Control.Arrow                    hiding (app)\nimport           Control.Concurrent\nimport           Control.Monad                    (forever)\nimport           Control.Monad.Trans.Reader\nimport           Control.Parallel.Strategies\nimport           Data.AttoLisp\nimport qualified Data.Attoparsec.ByteString.Char8 as AC\nimport qualified Data.Attoparsec.ByteString.Lazy  as A\nimport qualified Data.ByteString.Lazy.Char8       as B hiding (length)\nimport qualified Data.ByteString.Lazy.UTF8        as B (length)\nimport qualified Data.Map                         as M\nimport           Data.Maybe\nimport           Data.Monoid                      ((<>))\nimport           Data.Text                        (Text)\nimport qualified Data.Text                        as T\nimport           Foreign.Emacs.Internal\nimport           Language.Haskell.Exts            hiding (List, String, Symbol,\n                                                   name, sym)\nimport           Language.Haskell.Exts.SrcLoc\nimport qualified Language.Haskell.Exts.Syntax     as S (Name (Ident, Symbol))\nimport           System.IO                        (hFlush, stdout)\n\nclass Arity f where\n  arity :: f -> Int\n\ninstance Arity x where\n  arity _ = 0\n\ninstance {-# OVERLAPS #-} Arity f => Arity ((->) a f) where\n  arity f = 1 + arity (f undefined)\n\ndata Instruction = EmacsToHaskell Lisp\n                 | HaskellToEmacs B.ByteString\n                 | StartDialog (Emacs Lisp) Int\n\n{-@ StartDialog :: Emacs Lisp -> Nat -> Instruction @-}\n\n-- | Watch for commands and dispatch them in a seperate fork.\nmain :: IO ()\nmain = do\n  printer <- newChan\n  getter  <- newEmptyMVar\n  lock    <- newMVar ()\n  _       <- forkIO . forever $ readChan printer >>= B.putStr >> hFlush stdout\n  is      <- fullParse <$> B.getContents\n  mapM_ (forkIO . runInstruction lock getter printer) is\n\nrunInstruction :: MVar () -> MVar Lisp -> Chan B.ByteString -> Instruction -> IO ()\nrunInstruction _ g _ (EmacsToHaskell ls)                 = putMVar g   $! ls\nrunInstruction _ _ p (HaskellToEmacs msg)                = writeChan p $! msg\nrunInstruction l g p (StartDialog (EmacsInternal rdr) n) = withMVar l $ \\_ -> do\n  x <- runReaderT rdr (g, p)\n  writeChan p . formatResult n $ Success x\n\n-- | Recursively evaluate a lisp in parallel, using functions defined\n-- by the user (see documentation of the emacs function `haskell-emacs-init').\n{-@ Lazy traverseLisp @-}\ntraverseLisp :: Either (Emacs Lisp) Lisp -> Result (Either (Emacs Lisp) Lisp)\ntraverseLisp l = case l of\n  Right (List (Symbol x:xs)) -> sym (T.filter (/='\\\\') x) xs\n  Right (List xs)            -> Right . List <$> evl xs\n  Right (Symbol \"nil\")       -> Success $ Right nil\n  _                          -> Success l\n  where {-@ assume evl :: xs:[Lisp] -> Result {v:[Lisp] | len xs == len v} @-}\n        evl      = (>>= noNest) . sequence . parMap rdeepseq (traverseLisp . Right)\n        sym x xs = maybe (Right . List . (Symbol x:) <$> evl xs)\n                         (=<< (if length xs == 1 then head else List) <$> evl xs)\n                         $ M.lookup x dispatcher\n        noNest   = either (const (Error \"Emacs monad isn't nestable.\"))\n                          Success . sequence\n\n-- | Takes a stream of instructions and returns lazy list of\n-- results.\n{-@ Lazy fullParse @-}\nfullParse :: B.ByteString -> [Instruction]\nfullParse a = case parseInput a of A.Done a' b -> b : fullParse a'\n                                   A.Fail {}   -> []\n\n-- | Parse an instruction and stamp the number of the instruction into\n-- the result.\nparseInput :: B.ByteString -> A.Result Instruction\nparseInput = A.parse $ do\n  i          <- A.option 0 AC.decimal\n  isInternal <- isJust <$> optional \"|\"\n  l          <- lisp\n  return $ if isInternal\n    then EmacsToHaskell l\n    else case traverseLisp $ Right l of\n      Success (Left x)  -> StartDialog x i\n      Success (Right x) -> HaskellToEmacs . formatResult i $ Success x\n      Error x           -> HaskellToEmacs . formatResult i $ Error x\n\n-- | Scrape the documentation of haskell functions to serve it in emacs.\n{-@ getDocumentation :: x:[Text] -> Text -> {v:[Text] | len x == len v} @-}\ngetDocumentation :: [Text] -> Text -> [Text]\ngetDocumentation funs code =\n  map ( \\f -> T.unlines . (++) (filter (T.isPrefixOf (f <> \" ::\")) ls ++ [\"\"])\n      . reverse\n      . map (T.dropWhile (`elem` (\"- |\" :: String)))\n      . takeWhile (T.isPrefixOf \"-- \")\n      . reverse\n      $ takeWhile (not . T.isPrefixOf (f <> \" \")) ls\n      ) funs\n  where ls = T.lines code\n\n{-@ formatResult :: Nat -> Result Lisp -> B.ByteString @-}\nformatResult :: Int -> Result Lisp -> B.ByteString\nformatResult i l = f $ case l of\n      Success s -> (Just $ num i, encode s)\n      Error s   -> (Nothing     , errorE s)\n  where f (procNum, t) = encList (num (B.length t):maybeToList procNum) <> t\n        errorE msg     = encList [Symbol \"error\", String $ T.pack msg]\n        encList        = encode . List\n        num            = Number . fromIntegral\n\n-- | Map of available functions which get transformed to work on lisp.\ndispatcher :: M.Map Text (Lisp -> Result (Either (Emacs Lisp) Lisp))\ndispatcher = M.fromList $\n  [ (\"arityFormat\", transform arityFormat . normalize)\n  , (\"allExports\",  transform allExports)\n  , (\"arityList\",   transform $ \\() -> toDispatcher arityList)\n  , (\"formatCode\",  transform $ uncurry formatCode)\n  , (\"getDocumentation\", transform $ uncurry getDocumentation)\n  ] ++ []++[]\n\n-- | Transform a curried function to a function which receives and\n-- returns lisp forms.\ntransform :: (FromLisp a, ToEmacs b) => (a -> b) -> Lisp -> Result (Either (Emacs Lisp) Lisp)\ntransform = (. fromLisp) . fmap . (toEmacs .)\n\n-- | Prevent bad input for the bootstrap.\nnormalize :: Lisp -> Lisp\nnormalize l@(List _)      = l\nnormalize l@(DotList _ _) = l\nnormalize a               = List [a]\n\n-- | Takes tuples of function names and their arities and returns\n-- haskell source code which gets spliced back into a module.\ntoDispatcher :: [(String, Int)] -> (String, [String])\ntoDispatcher = (\"++\"++) . prettyPrint . listE . map fun\n               &&& map (filter (\\x -> x/=',' && x/='\\n')\n               . prettyPrint . pvarTuple . genNames \"x\" . snd)\n  where fun (f,n) = tuple [strE f, app (function \"transform\")\n                          $ lamE noLoc [pvarTuple $ genNames \"x\" n]\n                          (appFun (function f) . map var $ genNames \"x\" n)]\n\n-- | List of functions and their arities (filled by emacs).\narityList :: [(String, Int)]\narityList = []++[(\"Matrix.transpose\", arity Matrix.transpose),\n (\"Matrix.identity\", arity Matrix.identity),\n (\"Matrix.isIdentity\", arity Matrix.isIdentity),\n (\"Matrix.dyadic\", arity Matrix.dyadic)]\n\n-- | Splice user functions into the haskell module.\nformatCode :: (Text, Text, Text) -> Text -> Text\nformatCode (imports, exports, arities) = inject \"arity\"  arities\n                                       . inject \"export\" exports\n                                       . inject \"import\" imports\n  where inject s = T.replace (\"{--<<\" <> s <> \">>--}\")\n\n-- | Import statement of all modules and all their qualified functions.\nallExports :: [String] -> Either String (String, [String])\nallExports = (qualify . filter ((&&) <$> hasFunctions <*> isLibrary) <$>)\n             .  mapM exportsGet\n  where qualify ys   = ( unlines [prettyPrint $ ImportDecl noLoc q\n                                                True\n                                                False\n                                                False\n                                                Nothing\n                                                Nothing\n                                                Nothing | (q,_) <- ys]\n                       , [prettyPrint $ qvar q n | (q,ns) <- ys, n <- ns])\n        isLibrary    = (/=ModuleName \"Main\") . fst\n        hasFunctions = not . null . snd\n\n-- | List of haskell functions which get querried for their arity.\narityFormat :: [String] -> String\narityFormat = (\"++\"++) . prettyPrint\n              . listE . map (\\x -> tuple [strE x, app (function \"arity\")\n                                                      (function x)])\n\n-- | Retrieve the name and a list of exported functions of a haskell module.\n-- It should use 'parseFileContents' to take pragmas into account.\nexportsGet :: String -> Either String (ModuleName, [Name])\nexportsGet content = case parseSrc of\n  ParseOk (Module _ name _ _ header _ decls)\n    -> Right . (,) name $ maybe (exportsFromDecls decls)\n                                 exportsFromHeader header\n  ParseFailed _ msg -> Left msg\n  where parseSrc = parseFileContentsWithMode\n                     defaultParseMode {fixities = Nothing}\n                     content\n\nexportsFromDecls :: [Decl] -> [Name]\nexportsFromDecls = mapMaybe declarationNames\n\ndeclarationNames :: Decl -> Maybe Name\ndeclarationNames (FunBind (Match _ name _ _ _ _ : _)) = Just name\ndeclarationNames (PatBind _ (PVar name) _ _)          = Just name\ndeclarationNames _                                    = Nothing\n\n-- | Extract the unqualified function names from an ExportSpec.\nexportsFromHeader :: [ExportSpec] -> [Name]\nexportsFromHeader = mapMaybe exportFunction\n\nfromName :: Name -> String\nfromName (S.Symbol str) = str\nfromName (S.Ident  str) = str\n\nexportFunction :: ExportSpec -> Maybe Name\nexportFunction (EVar qname)        = unQualifiedName qname\nexportFunction (EModuleContents _) = Nothing\nexportFunction _                   = Nothing\n\nunQualifiedName :: QName -> Maybe Name\nunQualifiedName (Qual _ name) = Just name\nunQualifiedName (UnQual name) = Just name\nunQualifiedName _             = Nothing\n")
  (progn (haskell-emacs--compile (haskell-emacs--fun-body (quote formatCode) (list (list (car funs) (car arity-list) (haskell-emacs--fun-body (quote arityFormat) (car (cdr funs)))) code))))
  (if has-changed (progn (haskell-emacs--compile (haskell-emacs--fun-body (quote formatCode) (list (list (car funs) (car arity-list) (haskell-emacs--fun-body (quote arityFormat) (car ...))) code)))))
  (while (< a --dotimes-limit--) (setq arity-list (haskell-emacs--fun-body (quote arityList) (quote nil))) (if has-changed (progn (haskell-emacs--compile (haskell-emacs--fun-body (quote formatCode) (list (list (car funs) (car arity-list) (haskell-emacs--fun-body ... ...)) code))))) (setq a (1+ a)))
  (let ((--dotimes-limit-- 2) (a 0)) (while (< a --dotimes-limit--) (setq arity-list (haskell-emacs--fun-body (quote arityList) (quote nil))) (if has-changed (progn (haskell-emacs--compile (haskell-emacs--fun-body (quote formatCode) (list (list ... ... ...) code))))) (setq a (1+ a))))
  (let* ((first-time (if (file-directory-p haskell-emacs-dir) nil (if arg (haskell-emacs--install-dialog) (mkdir haskell-emacs-dir t)))) (funs (haskell-emacs-filter (function (lambda (x) (not (or ... ...)))) (directory-files haskell-emacs-dir t "^[^.].+.hs$"))) (process-connection-type nil) (arity-list) (docs) (has-changed t) (heF "HaskellEmacs.hs") (code (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert-file-contents ...) (buffer-string)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))))) (haskell-emacs--set-bin) (haskell-emacs--stop-proc) (setq haskell-emacs--response nil) (setq haskell-emacs--function-hash (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (mapc (quote insert-file-contents) funs) (insert haskell-emacs-dir (format "%S" haskell-emacs-build-tool)) (sha1 (buffer-string))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) (setq has-changed (not (and haskell-emacs--bin (file-exists-p haskell-emacs--bin) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ... ...))))))) (if has-changed (progn (haskell-emacs--compile code))) (haskell-emacs--start-proc) (setq funs (mapcar (function (lambda (f) (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...))))) funs) docs (apply (quote concat) funs) funs (haskell-emacs--fun-body (quote allExports) (apply (quote list) "" "" funs))) (if (stringp funs) (progn (haskell-emacs--stop-proc) (error funs))) (setq docs (haskell-emacs--fun-body (quote getDocumentation) (list (mapcar (function (lambda (x) (cadr ...))) (cadr funs)) docs))) (let ((--dotimes-limit-- 2) (a 0)) (while (< a --dotimes-limit--) (setq arity-list (haskell-emacs--fun-body (quote arityList) (quote nil))) (if has-changed (progn (haskell-emacs--compile (haskell-emacs--fun-body (quote formatCode) (list ... code))))) (setq a (1+ a)))) (let ((arity (cadr arity-list)) (table-of-funs (make-hash-table :test (quote equal)))) (mapc (function (lambda (func) (let ((id ...)) (puthash id (concat ... ...) table-of-funs)))) (cadr funs)) (maphash (function (lambda (key value) (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...))))) table-of-funs)) (if arg (progn (if (equal first-time "example") (message "Now you can run the examples from C-h f haskell-emacs-init.\nFor example (Matrix.transpose '((1 2 3) (4 5 6)))") (if (equal first-time "no-example") (message "Now you can populate your `haskell-emacs-dir' with haskell modules.\nRead C-h f haskell-emacs-init for more instructions") (message "Finished compiling haskell-emacs."))))))
  haskell-emacs-init(1)
  call-interactively(haskell-emacs-init record nil)
  command-execute(haskell-emacs-init record)
  helm-M-x(nil "haskell-emacs-init")
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)

via melpa

Debugger entered--Lisp error: (error "Writing a default package environment file to
c:\\Users\\Eleven\\.emacs.d\\haskell-fun\\cabal.sandbox.config
Using an existing sandbox located at
C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox
Resolving dependencies...
Notice: installing into a sandbox located at
C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox
Configuring happy-1.19.5...
Building happy-1.19.5...
Installed happy-1.19.5
Resolving dependencies...
Notice: installing into a sandbox located at
C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox
Configuring HaskellEmacs-0.0.0...
Building HaskellEmacs-0.0.0...
Failed to install HaskellEmacs-0.0.0
Build log ( C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\logs\\HaskellEmacs-0.0.0.log ):
Installing executable(s) in
C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\bin
copyFile: permission denied (\276ܾ\370\267\303\316ʡ\243)
acs.Internal ( Foreign\\Emacs\\Internal.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Foreign\\Emacs\\Internal.o )
[2 of 3] Compiling Matrix           ( Matrix.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Matrix.o )
[3 of 3] Compiling Main             ( HaskellEmacs.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Main.o )
Linking dist/dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs.exe ...
cabal: Leaving directory '.'
cabal.exe: Error: some packages failed to install:
HaskellEmacs-0.0.0 failed during the final install step. The exception was:
ExitFailure 1
")
  signal(error ("Writing a default package environment file to\nc:\\Users\\Eleven\\.emacs.d\\haskell-fun\\cabal.sandbox.config\nUsing an existing sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nResolving dependencies...\nNotice: installing into a sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nConfiguring happy-1.19.5...\nBuilding happy-1.19.5...\nInstalled happy-1.19.5\nResolving dependencies...\nNotice: installing into a sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nConfiguring HaskellEmacs-0.0.0...\nBuilding HaskellEmacs-0.0.0...\nFailed to install HaskellEmacs-0.0.0\nBuild log ( C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\logs\\HaskellEmacs-0.0.0.log ):\nInstalling executable(s) in\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\bin\ncopyFile: permission denied (\276ܾ\370\267\303\316ʡ\243)\nacs.Internal ( Foreign\\Emacs\\Internal.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Foreign\\Emacs\\Internal.o )\n[2 of 3] Compiling Matrix           ( Matrix.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Matrix.o )\n[3 of 3] Compiling Main             ( HaskellEmacs.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Main.o )\nLinking dist/dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs.exe ...\ncabal: Leaving directory '.'\ncabal.exe: Error: some packages failed to install:\nHaskellEmacs-0.0.0 failed during the final install step. The exception was:\nExitFailure 1\n"))
  error("Writing a default package environment file to\nc:\\Users\\Eleven\\.emacs.d\\haskell-fun\\cabal.sandbox.config\nUsing an existing sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nResolving dependencies...\nNotice: installing into a sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nConfiguring happy-1.19.5...\nBuilding happy-1.19.5...\nInstalled happy-1.19.5\nResolving dependencies...\nNotice: installing into a sandbox located at\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\nConfiguring HaskellEmacs-0.0.0...\nBuilding HaskellEmacs-0.0.0...\nFailed to install HaskellEmacs-0.0.0\nBuild log ( C:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\logs\\HaskellEmacs-0.0.0.log ):\nInstalling executable(s) in\nC:\\Users\\Eleven\\.emacs.d\\haskell-fun\\.cabal-sandbox\\bin\ncopyFile: permission denied (\276ܾ\370\267\303\316ʡ\243)\nacs.Internal ( Foreign\\Emacs\\Internal.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Foreign\\Emacs\\Internal.o )\n[2 of 3] Compiling Matrix           ( Matrix.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Matrix.o )\n[3 of 3] Compiling Main             ( HaskellEmacs.hs, dist\\dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs-tmp\\Main.o )\nLinking dist/dist-sandbox-d5154e5b\\build\\HaskellEmacs\\HaskellEmacs.exe ...\ncabal: Leaving directory '.'\ncabal.exe: Error: some packages failed to install:\nHaskellEmacs-0.0.0 failed during the final install step. The exception was:\nExitFailure 1\n")
  haskell-emacs--compile-command("*HASKELL-BUFFER*")
  haskell-emacs--compile("{-# LANGUAGE FlexibleInstances #-}\n{-# LANGUAGE OverloadedStrings #-}\n\n-- WARNING: Please note that this file is autogenerated.\n--\n-- If you want to change this file, you have to clone the github repo and apply the changes in a local repo.\n\nmodule Main where\nimport qualified Matrix\n\nimport           Control.Applicative              (optional, (<$>), (<*>))\nimport           Control.Arrow                    hiding (app)\nimport           Control.Concurrent\nimport           Control.Monad                    (forever)\nimport           Control.Monad.Trans.Reader\nimport           Control.Parallel.Strategies\nimport           Data.AttoLisp\nimport qualified Data.Attoparsec.ByteString.Char8 as AC\nimport qualified Data.Attoparsec.ByteString.Lazy  as A\nimport qualified Data.ByteString.Lazy.Char8       as B hiding (length)\nimport qualified Data.ByteString.Lazy.UTF8        as B (length)\nimport qualified Data.Map                         as M\nimport           Data.Maybe\nimport           Data.Monoid                      ((<>))\nimport           Data.Text                        (Text)\nimport qualified Data.Text                        as T\nimport           Foreign.Emacs.Internal\nimport           Language.Haskell.Exts            hiding (List, String, Symbol,\n                                                   name, sym)\nimport           Language.Haskell.Exts.SrcLoc\nimport qualified Language.Haskell.Exts.Syntax     as S (Name (Ident, Symbol))\nimport           System.IO                        (hFlush, stdout)\n\nclass Arity f where\n  arity :: f -> Int\n\ninstance Arity x where\n  arity _ = 0\n\ninstance {-# OVERLAPS #-} Arity f => Arity ((->) a f) where\n  arity f = 1 + arity (f undefined)\n\ndata Instruction = EmacsToHaskell Lisp\n                 | HaskellToEmacs B.ByteString\n                 | StartDialog (Emacs Lisp) Int\n\n{-@ StartDialog :: Emacs Lisp -> Nat -> Instruction @-}\n\n-- | Watch for commands and dispatch them in a seperate fork.\nmain :: IO ()\nmain = do\n  printer <- newChan\n  getter  <- newEmptyMVar\n  lock    <- newMVar ()\n  _       <- forkIO . forever $ readChan printer >>= B.putStr >> hFlush stdout\n  is      <- fullParse <$> B.getContents\n  mapM_ (forkIO . runInstruction lock getter printer) is\n\nrunInstruction :: MVar () -> MVar Lisp -> Chan B.ByteString -> Instruction -> IO ()\nrunInstruction _ g _ (EmacsToHaskell ls)                 = putMVar g   $! ls\nrunInstruction _ _ p (HaskellToEmacs msg)                = writeChan p $! msg\nrunInstruction l g p (StartDialog (EmacsInternal rdr) n) = withMVar l $ \\_ -> do\n  x <- runReaderT rdr (g, p)\n  writeChan p . formatResult n $ Success x\n\n-- | Recursively evaluate a lisp in parallel, using functions defined\n-- by the user (see documentation of the emacs function `haskell-emacs-init').\n{-@ Lazy traverseLisp @-}\ntraverseLisp :: Either (Emacs Lisp) Lisp -> Result (Either (Emacs Lisp) Lisp)\ntraverseLisp l = case l of\n  Right (List (Symbol x:xs)) -> sym (T.filter (/='\\\\') x) xs\n  Right (List xs)            -> Right . List <$> evl xs\n  Right (Symbol \"nil\")       -> Success $ Right nil\n  _                          -> Success l\n  where {-@ assume evl :: xs:[Lisp] -> Result {v:[Lisp] | len xs == len v} @-}\n        evl      = (>>= noNest) . sequence . parMap rdeepseq (traverseLisp . Right)\n        sym x xs = maybe (Right . List . (Symbol x:) <$> evl xs)\n                         (=<< (if length xs == 1 then head else List) <$> evl xs)\n                         $ M.lookup x dispatcher\n        noNest   = either (const (Error \"Emacs monad isn't nestable.\"))\n                          Success . sequence\n\n-- | Takes a stream of instructions and returns lazy list of\n-- results.\n{-@ Lazy fullParse @-}\nfullParse :: B.ByteString -> [Instruction]\nfullParse a = case parseInput a of A.Done a' b -> b : fullParse a'\n                                   A.Fail {}   -> []\n\n-- | Parse an instruction and stamp the number of the instruction into\n-- the result.\nparseInput :: B.ByteString -> A.Result Instruction\nparseInput = A.parse $ do\n  i          <- A.option 0 AC.decimal\n  isInternal <- isJust <$> optional \"|\"\n  l          <- lisp\n  return $ if isInternal\n    then EmacsToHaskell l\n    else case traverseLisp $ Right l of\n      Success (Left x)  -> StartDialog x i\n      Success (Right x) -> HaskellToEmacs . formatResult i $ Success x\n      Error x           -> HaskellToEmacs . formatResult i $ Error x\n\n-- | Scrape the documentation of haskell functions to serve it in emacs.\n{-@ getDocumentation :: x:[Text] -> Text -> {v:[Text] | len x == len v} @-}\ngetDocumentation :: [Text] -> Text -> [Text]\ngetDocumentation funs code =\n  map ( \\f -> T.unlines . (++) (filter (T.isPrefixOf (f <> \" ::\")) ls ++ [\"\"])\n      . reverse\n      . map (T.dropWhile (`elem` (\"- |\" :: String)))\n      . takeWhile (T.isPrefixOf \"-- \")\n      . reverse\n      $ takeWhile (not . T.isPrefixOf (f <> \" \")) ls\n      ) funs\n  where ls = T.lines code\n\n{-@ formatResult :: Nat -> Result Lisp -> B.ByteString @-}\nformatResult :: Int -> Result Lisp -> B.ByteString\nformatResult i l = f $ case l of\n      Success s -> (Just $ num i, encode s)\n      Error s   -> (Nothing     , errorE s)\n  where f (procNum, t) = encList (num (B.length t):maybeToList procNum) <> t\n        errorE msg     = encList [Symbol \"error\", String $ T.pack msg]\n        encList        = encode . List\n        num            = Number . fromIntegral\n\n-- | Map of available functions which get transformed to work on lisp.\ndispatcher :: M.Map Text (Lisp -> Result (Either (Emacs Lisp) Lisp))\ndispatcher = M.fromList $\n  [ (\"arityFormat\", transform arityFormat . normalize)\n  , (\"allExports\",  transform allExports)\n  , (\"arityList\",   transform $ \\() -> toDispatcher arityList)\n  , (\"formatCode\",  transform $ uncurry formatCode)\n  , (\"getDocumentation\", transform $ uncurry getDocumentation)\n  ] ++ []++[]\n\n-- | Transform a curried function to a function which receives and\n-- returns lisp forms.\ntransform :: (FromLisp a, ToEmacs b) => (a -> b) -> Lisp -> Result (Either (Emacs Lisp) Lisp)\ntransform = (. fromLisp) . fmap . (toEmacs .)\n\n-- | Prevent bad input for the bootstrap.\nnormalize :: Lisp -> Lisp\nnormalize l@(List _)      = l\nnormalize l@(DotList _ _) = l\nnormalize a               = List [a]\n\n-- | Takes tuples of function names and their arities and returns\n-- haskell source code which gets spliced back into a module.\ntoDispatcher :: [(String, Int)] -> (String, [String])\ntoDispatcher = (\"++\"++) . prettyPrint . listE . map fun\n               &&& map (filter (\\x -> x/=',' && x/='\\n')\n               . prettyPrint . pvarTuple . genNames \"x\" . snd)\n  where fun (f,n) = tuple [strE f, app (function \"transform\")\n                          $ lamE noLoc [pvarTuple $ genNames \"x\" n]\n                          (appFun (function f) . map var $ genNames \"x\" n)]\n\n-- | List of functions and their arities (filled by emacs).\narityList :: [(String, Int)]\narityList = []++[(\"Matrix.transpose\", arity Matrix.transpose),\n (\"Matrix.identity\", arity Matrix.identity),\n (\"Matrix.isIdentity\", arity Matrix.isIdentity),\n (\"Matrix.dyadic\", arity Matrix.dyadic)]\n\n-- | Splice user functions into the haskell module.\nformatCode :: (Text, Text, Text) -> Text -> Text\nformatCode (imports, exports, arities) = inject \"arity\"  arities\n                                       . inject \"export\" exports\n                                       . inject \"import\" imports\n  where inject s = T.replace (\"{--<<\" <> s <> \">>--}\")\n\n-- | Import statement of all modules and all their qualified functions.\nallExports :: [String] -> Either String (String, [String])\nallExports = (qualify . filter ((&&) <$> hasFunctions <*> isLibrary) <$>)\n             .  mapM exportsGet\n  where qualify ys   = ( unlines [prettyPrint $ ImportDecl noLoc q\n                                                True\n                                                False\n                                                False\n                                                Nothing\n                                                Nothing\n                                                Nothing | (q,_) <- ys]\n                       , [prettyPrint $ qvar q n | (q,ns) <- ys, n <- ns])\n        isLibrary    = (/=ModuleName \"Main\") . fst\n        hasFunctions = not . null . snd\n\n-- | List of haskell functions which get querried for their arity.\narityFormat :: [String] -> String\narityFormat = (\"++\"++) . prettyPrint\n              . listE . map (\\x -> tuple [strE x, app (function \"arity\")\n                                                      (function x)])\n\n-- | Retrieve the name and a list of exported functions of a haskell module.\n-- It should use 'parseFileContents' to take pragmas into account.\nexportsGet :: String -> Either String (ModuleName, [Name])\nexportsGet content = case parseSrc of\n  ParseOk (Module _ name _ _ header _ decls)\n    -> Right . (,) name $ maybe (exportsFromDecls decls)\n                                 exportsFromHeader header\n  ParseFailed _ msg -> Left msg\n  where parseSrc = parseFileContentsWithMode\n                     defaultParseMode {fixities = Nothing}\n                     content\n\nexportsFromDecls :: [Decl] -> [Name]\nexportsFromDecls = mapMaybe declarationNames\n\ndeclarationNames :: Decl -> Maybe Name\ndeclarationNames (FunBind (Match _ name _ _ _ _ : _)) = Just name\ndeclarationNames (PatBind _ (PVar name) _ _)          = Just name\ndeclarationNames _                                    = Nothing\n\n-- | Extract the unqualified function names from an ExportSpec.\nexportsFromHeader :: [ExportSpec] -> [Name]\nexportsFromHeader = mapMaybe exportFunction\n\nfromName :: Name -> String\nfromName (S.Symbol str) = str\nfromName (S.Ident  str) = str\n\nexportFunction :: ExportSpec -> Maybe Name\nexportFunction (EVar qname)        = unQualifiedName qname\nexportFunction (EModuleContents _) = Nothing\nexportFunction _                   = Nothing\n\nunQualifiedName :: QName -> Maybe Name\nunQualifiedName (Qual _ name) = Just name\nunQualifiedName (UnQual name) = Just name\nunQualifiedName _             = Nothing\n")
  haskell-emacs-init(1)
  call-interactively(haskell-emacs-init record nil)
  command-execute(haskell-emacs-init record)
  helm-M-x(nil "haskell-emacs-init")
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)