dante's People
Forkers
gitter-badger emacsmirror tmcgilchrist aljce ttuegel gridaphobe aisamanra puffnfresh dudebout ljli purcell alexeyzab marsam endgame apeyroux zarybnicky templatek timsears david-christiansen sboehler tseenshe elgusy matthewbauer sboosali leungbk emmanueldenloye conal lehins herwigstuetz lgastako walseb cydparser amazari arthurl haskellall pigmej sergv akirak ivan-m danmatichuk plumpmath nizar-m martinsos dwarfmaster brechtserckx tomjaguarpaw shajra chaoky standardgalactic stevladimir stillerharpodante's Issues
Hide markers when Dante is busy
Warning and error indicators in the buffer should not be present when Dante is busy. Stale indicators are confusing. They should be removed until Dante is sure they should be there again.
Default `-Wall` overrides cabal settings
The default setting of -Wall
in dante-load-flags
overrides cabal settings if cabal contains some disabled warnings, for example -Wno-missing-signature
.
This is not an important issue, but it can be surprising.
`nix` method init failure: Cannot auto-call a function that has an argument without a default value (‘mkDerivation’).
Dante fails to start nix-shell --run "cabal repl"
, even though I can do it manually.
The key error message looks like it is Cannot auto-call a function that has an argument without a default value (‘mkDerivation’)
.
Facts
- emacs is
25.1.1
- dante is
20170207.234
(Melpa) - cabal is
1.24.0.2
haskell-mode-hook
has both(dante-mode +1)
and(flycheck-mode +1)
- opening a source file yields this:
This where GHCi output is bufferized. This buffer is normally hidden,
but a problem occcured.
EXTRA TROUBLESHOOTING INFO
The GHCi process ended. Here is the reason that Emacs gives us: exited abnormally with code 1
Directory:/home/deepfire/holotype/
Command line:(nix-shell --run cabal repl )
Loaded:
State: dead
Queue: nil
Callback: #[128 \302\300\303\301�""\207 [dante-wait-for-prompt (Flatland.hs :set -Wall
:set +c
:set prompt "\4%s|" �[31;1merror:�[0m cannot auto-call a function that has an argument without a default value (‘mkDerivation’)
#[257 \301\302!\210\303\300!\207 [ dante:holotype: /home/deepfire/holotype/ message GHCi started! dante-schedule-next] 3
(fn START-MESSAGES)]) apply append] 6
(fn &rest ARGS2)]
WHAT TO DO NEXT
Try to customize (probably file or directory-locally)
`dante-project-root' and/or `dante-repl-command-line'. If you
fixed the problem, just kill this buffer, Dante will make a fresh
one and attempt to restart GHCi automatically.
If you are unable to fix the problem, just leave this buffer
around and Dante will not attempt to restart GHCi.
You can always run M-x dante-restart to make it try again.
Observations
Directory
from above log looks right, althoughdante-project-root
isnil
in the source buffer- Running
nix-shell --run "cabal repl"
manually properly starts building the project:
deepfire@andromedae:~/holotype$ nix-shell --run "cabal repl"
Preprocessing library holotype-0.0.1...
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/deepfire/.ghci
[ 1 of 14] Compiling Reflex.Random ( src/Reflex/Random.hs, interpreted )
[ 2 of 14] Compiling Reflex.GLFW ( src/Reflex/GLFW.hs, interpreted )
[ 3 of 14] Compiling HoloSys ( src/HoloSys.hs, interpreted )
[ 4 of 14] Compiling HoloCairo ( src/HoloCairo.hs, interpreted )
[ 5 of 14] Compiling Elsewhere ( src/Elsewhere.hs, interpreted )
[ 6 of 14] Compiling Data.MeasuredMonoid ( src/Data/MeasuredMonoid.hs, interpreted )
[ 7 of 14] Compiling Flatland ( src/Flatland.hs, interpreted )
src/Flatland.hs:402:1: warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In an equation for ‘computeRequires’:
Patterns not matched: (CF _ (CGrid _ _))
[ 8 of 14] Compiling FlatDraw ( src/FlatDraw.hs, interpreted )
src/FlatDraw.hs:118:40: error:
Not in scope: type constructor or class ‘S’
src/FlatDraw.hs:118:42: error:
Not in scope: type constructor or class ‘Wrap’
src/FlatDraw.hs:119:28: error:
Not in scope: data constructor ‘Pwrap’
src/FlatDraw.hs:120:11: error:
Not in scope: data constructor ‘Parea’
Failed, modules loaded: Data.MeasuredMonoid, Elsewhere, Flatland, HoloCairo, HoloSys, Reflex.GLFW, Reflex.Random.
*Data.MeasuredMonoid Text.Printf>
Leaving GHCi.
`dante-project-root` not tracking emacsclient sessions
Steps to reproduce:
- Have 2 haskell projects on hand.
emacs --daemon
- Open one project up in a fresh
emacsclient
window, navigate to a.hs
file and note that dante works. - Open up the second project in a second
emacsclient
window and navigate to a.hs
file. - Observe that the dante ghci instance is loading up files from the first project.
I saw that in the comments on #32 that there is now caching of the dante-project-root
variable, perhaps this is the bug?
Feature Request: integration with pointfree and pointful.
Having the ability to mark a section of code, ask what the pointfree version looks like, and optionally replace it with that version, is very nice.
Emacs 24.x support
Is there any chance that dante
can support Emacs 24.x in the future?
`ghc-options` (from cabal file) not read by `dante` ?
dante
does not seem to care about my cabal ghc option setting. For instance:
ghc-options: -Wall -Wno-name-shadowing -Wno-missing-signatures
This forces me to use a pragma instead as a workaround:
{-# OPTIONS_GHC -Wall -Wno-name-shadowing -Wno-missing-signatures #-}
Flycheck + hlint
First off, I love dante. It allowed me to strip a ton of workarounds out of my Emacs configuration. Thank you!
The only thing I miss from my previous configuration is flycheck providing warnings from hlint. I'm guessing something in haskell-mode was turning that on for me. Any suggestions on how to enable that with dante?
Thank you.
Appending an empty argument?… *.*
I’m curious about this line:
(let* ((args (append (dante-repl-command-line) (list (or dante-target ""))))
Line 552 in 815f022
So if (not dante-target)
, there’ll always be a single ""
added to argument list… Let’s try that out:
% nix-shell --run "cabal repl" ""
/run/user/31337/nix-shell.KqRB7w/rc: line 1: cabal: command not found
(127)%
or with some custom Makefile
:
% make repl ""
make: *** empty string invalid as file name. Stop.
(2)%
We cannot assume that ""
is safe to add to an arbitrary command, because some tools ignore it, can we?
And even no all from the default alist do (nix-shell
above)…
Dante and cabal repl reset each other's incremental build state
Whenever dante checks a file in my emacs, and I subsequently run cabal build
or cabal repl
from the command line, it starts rebuilding every module in my project. The same happens if after cabal build
/cabal repl
I start dante.
It would be great if dante and my commands could share the incremental build state.
I'm using nix, so both dante and cabal build
are run inside nix-shell.
company-mode breaks dante
When I add company-mode
to dante-mode-hook
, starting dante yields this error:
found nil end 388 start 357 id-start 47
And then dante gets stuck in a busy
state. If I don't add it as a hook and manually run company-mode
after dante-mode
, it works for one completion before breaking in the same way.
Sorry, I'm quite useless with Emacs lisp, so I don't have the first idea of how to debug this.
void `dante-command-line`, then hangs
I get this error when loading
error in process sentinel: save-current-buffer: Symbol’s value as variable is void: dante-command-line
error in process sentinel: Symbol’s value as variable is void: dante-command-line
then Emacs hangs if I use any Dante functions (like type-of).
my initialization:
(use-package dante :commands 'dante-mode :init (add-hook 'haskell-mode-hook 'dante-mode) (add-hook 'haskell-mode-hook 'flycheck-mode))
Dante version is the latest (as of today).
Error when loading nix-shell
I'm getting the following error when dante starts:
error: cannot auto-call a function that has an argument without a default value (‘mkDerivation’)
Using the command nix-shell --run 'cabal repl'
works normally when I launch it from the shell. I get the same error if I do nix-shell default.nix
.
My shell.nix
is the following:
with (import <nixpkgs> {});
(haskellPackages.callPackage ./. {}).env
Feature request: add eldoc for type (for thing at point)
I realize that it seems minor, but it's astonishingly valuable to have the extra convenience of seeing the type displayed in the message area without having to request it (via C-c .
).
use-package error
evaling
(use-package dante
:ensure t
:commands 'dante-mode
:init
(add-hook 'haskell-mode-hook 'dante-mode)
(add-hook 'haskell-mode-hook 'flycheck-mode))
gives
package-compute-transaction: Package ‘dante-’ is unavailable
as does just
(use-package dante
:ensure t
)
why is there a hyphen? dante.el is on my load path too.
Nix integration is broken
I believe this is a different issue than #9, as he appears to be picking up the wrong shell.nix
somehow. But this error seems to mean that it simply can't run cabal repl
for some reason. I am able to do nix-shell --run "cabal repl"
manually. I thought it might have to do with the environment variables that Emacs sees, but I tried launching emacs from the same shell where I could do the nix-shell
from, in order to make sure Emacs sees the same environment variables, and the same error occurred.
This where GHCi output is bufferized. This buffer is normally hidden,
but a problem occcured.
EXTRA TROUBLESHOOTING INFO
The GHCi process ended. Here is the reason that Emacs gives us: exited abnormally with code 127
Directory:/home/will/Documents/dante-test/
Command line:(nix-shell --run cabal repl )
Loaded:
State: dead
Queue: nil
Callback: #[128 \302\300\303\301�""\207 [dante-wait-for-prompt (Lib.hs :set -Wall
:set +c
:set prompt "\4%s|" /run/user/1000/nix-shell.FLXG8B/rc: line 1: cabal: command not found
#[257 \301\302!\210\303\300!\207 [ dante:dante-test: /home/will/Documents/dante-test/ message GHCi started! dante-schedule-next] 3
(fn START-MESSAGES)]) apply append] 6
(fn &rest ARGS2)]
WHAT TO DO NEXT
Try to customize (probably file or directory-locally)
`dante-project-root' and/or `dante-repl-command-line'. If you
fixed the problem, just kill this buffer, Dante will make a fresh
one and attempt to restart GHCi automatically.
If you are unable to fix the problem, just leave this buffer
around and Dante will not attempt to restart GHCi.
You can always run M-x dante-restart to make it try again.
Multi-target projects — “depender” GHCi doesn’t get changes from dependency?
If, in a single .cabal
file, I have, say:
- a
library
, - and an
executable something
, - and make this executable depend on that library,
- and start Dante in this executable’s context (
cabal repl exe:something
in anix-shell
), - and change some Haskell sources in the
library
…
… I have to do M-x dante-restart
to get the library changes visible in executable’s Dante.
Is this the expected behavior? :o
Initialization blocks for REPLoid
I like to call out to R with inline-r
from my Haskell buffers. This requires that I initialize R in a particular way, so I have a code block at the top of the file with the appropriate commands. But, that requires that I remember to run that block before I try to evaluate any other code blocks! It would be nice to be able to designate an "initialization" block that is guaranteed to be run before any other code blocks in a buffer.
Possibility to use without `cabal-install`.
First, this is very useful, thanks for creating!
I switched my emacs configuration to use dante
; because I do not want to depend either on stack/intero
or ghc-mod
. However, Dante still depends on cabal-install
and which I do not generally install because I use nix
instead. Is there a way to use only only ghci
instead of cabal-repl
? I'm ready to give up some more features if they require cabal repl
.
But still depending on cabal-install
is better than ghc-mod
or intero
; since it's easier to install and much more common.
Restarting Dante does not re-eval a nix expression
If I edit a Haskell file that is in a dependency and restarts Dante from spacemacs, the ghci process restarts, but the nix expression does not re-evaluate. Meaning the new ghci process receives an out of date dependency. When in a nix context, either restarting Dante should re-eval the nix expression, or that option should be provided as another command restart-dante-hard
or something.
goto next error
I can't seem to get this to work. I've used every next-error
variant I can find, and while errors show up inline in my code, I can't jump to them. It says "no errors in buffer".
Can't find Stack's global ghc?
Trying to start dante on a haskell file without a corresponding cabal or stack.yaml file I get this:
Command line:(cabal repl)
Loaded:
State: dead
Queue: nil
Callback: #[128 \302\300\303\301�""\207 [dante-wait-for-prompt (mklinks.hs :set -Wall
:set +c
:set prompt "\4%s|" cabal: The program 'ghc' version >=6.4 is required but it could not be found.
#[257 \301\302!\210\303\300!\207 [ dante:: /home/torstein/config/ message GHCi started! dante-schedule-next] 3
(fn START-MESSAGES)]) apply append] 6
(fn &rest ARGS2)]
I only have Stack installed on my system, so stack ghc
is reachable and working through terminal but not ghc
.
Flycheck gets confused if dante is restarted
Running dante-restart
seems to confuse Flycheck, which stops reporting anything. Turning Flycheck off and on again fixes the problem. It would be nice if dante restarted Flycheck automatically if it is enabled.
Overzealous comment overwriting
If you write a Dante eval block above a legitimate comment and then evaluate it, the legit comment will be overwritten:
-- >>> foo 5
-- | Best function
foo :: Int -> String
foo = show
becomes
-- >>> foo 5
-- "5"
foo :: Int -> String
foo = show
whereas I expected:
-- >>> foo 5
-- "5"
-- | Best function
foo :: Int -> String
foo = show
Wrong stanza's dependencies loaded
I have a cabal file containing a library stanza followed by an executable stanza. I have run emacs from the directory containing the cabal file, and I have opened a source file from the executable (i.e. the second) stanza. Dante highlights some of the imports in that source file, indicating a failure to load the interface, and suggesting that I add the package is comes from to my cabal file. The imports for which this is an issue are the ones that exist in the executable stanza's build-depends but not in the library stanza's build-depends.
This is the same behavior that I see if I run 'cabal repl'. In this case, the solution is to run 'cabal repl exename', which tells it to load the dependencies of that particular stanza. I don't know what the solution is in the case of dante.
Often Dante can't get the type but can get info
C-c-.
will often say that a variable is not in scope, or that it cannot get the module name, where C-c-,
will succeed. This puts me in an awkward position, of just needing quick info about something, and not knowing which command to pick. A command that does both with failover would be very nice.
keybinding [C-c '] is conflict with Org-mode babel editing keybinding.
RT.
dante-status being called thousands of times over a few seconds
I sometimes open a new Haskell file outside of a project. When I do this Dante gets very slow and Emacs sits at about 100% CPU whenever I edit the buffer.
I found that Emacs supports profiling via (profiler-start)
then I did a (profiler-report)
to get:
- redisplay_internal (C function) 7700 46%
- eval 7158 42%
- spaceline-ml-main 6837 41%
- mapcar 6754 40%
- #<compiled 0x24da0c3> 6751 40%
- format-mode-line 6741 40%
- eval 6741 40%
- concat 6741 40%
- dante-status 6741 40%
- dante-state 4555 27%
- dante-buffer-p 4555 27%
- dante-buffer-name 4555 27%
- dante-project-root 4555 27%
- dante-cabal-find-file 4553 27%
- dante-cabal-find-pkg-desc 4343 26%
+ directory-files 2516 15%
+ cl-remove-if-not 1 0%
+ file-attributes 19 0%
+ dante-buffer-file-name 1 0%
- dante-buffer-p 2186 13%
+ dante-buffer-name 2186 13%
+ s-trim 2 0%
So I guess the root cause is that Dante is trying to get a .cabal file over and over and not finding one. Can we make Dante not spike to 100% whenever I edit a file without a .cabal project?
Warnings disappear after saving a buffer
Hi,
I've tried using Dante (in combination with reflex-platform through a custom dante-repl-command-line going through nix-shell). Everything works fine, with one exception - after I save a file, flycheck triggers and all warnings disappear. If the file doesn't compile and has some errors, they stay visible.
I don't have the elisp knowledge to debug it all the way (or the time to learn right now), but I've managed to trace it down to https://github.com/jyp/dante/blob/master/dante.el#L350.
If I replace :buffer (when (string= temp-file file) buffer)
with simply :buffer buffer
, the warnings stay visible after saving as well.
That has solved my problem for now and I'm currently long past my bedtime, so I'll just leave this here in case I forget about it tomorrow. Next step would be to learn how debug elisp properly instead of just reading through flycheck and dante code randomly :)
Type inspection misreports, when symbols are used
I have the following function
foo :: Int -> Int
foo x = x + 1
type inspecting works for either representation of x
as we would expect.
foo :: Int -> Int
foo x = x + 1
-- ^ C-c-.
x :: Int
foo :: Int -> Int
foo x = x + 1
-- ^ C-c-.
x :: Int
But for this function, things are jacked
quadOut :: Fractional a => a -> a
quadOut time = negate time * (time - 2)
-- ^ C-c-.
time :: a
quadOut :: Fractional a => a -> a
quadOut time = negate time * (time - 2)
-- ^ C-c-.
interactive:1:1: error: Variable not in scope: time
This is obviously wrong as the code compiles fine and time
is clearly in scope.
quadOut :: Fractional a => a -> a
quadOut time = negate time * (time - 2)
-- ^ C-c-.
time :: a -> a -> a
This is more evil as it's actually misleading. If I as an engineer did not already know the type of time
and was looking to learn the type (the purpose of this feature), I would have no way of knowing the feedback being given is outright false.
The symbol of doom
This bug goes away if prettify-symbols
mode is turned off. In the function quadOut
, the problem is caused by an interaction with:
(defconst prettify-symbols-alist
'(...
("negate" . ?¬)
...))
Observed in spacemacs
flycheck-mode hook and dir-locals
This is more of a note for everyone using a .dir-locals.el
file to set dante-target
.
When using dante with the recommended entry in my .emacs
file as described in the readme, I had an issue where every time I opened a .hs
file, the dante-target
variable would be overwritten to nil
and subsequently dante fails because cabal can't handle multiple targets. This prevented me from using Emacs' dir-locals feature to tell dante which target to use.
The workaround was to remove the following flycheck-mode hook (I don't understand why this fixes the problem or why flycheck keeps working without this line):
(add-hook 'haskell-mode-hook 'flycheck-mode)
Info buffer steals focus.
When asking for info C-c-,
the info shows up in a new buffer (unlike asking for a type). This buffer steals focus from the existing buffer making subsequent commands not work without reverting focus. The behavior of info should be more in line with the behavior of getting the type.
Support for GHC 8.2 caret in error message
GHC 8.2 introduces caret in error message, for example:
Err.hs:1:1: warning: [-Wmissing-signatures]
Top-level binding with no type signature: f :: Num a => a -> a -> a
|
1 | f x y = x + y
| ^
Unfortunately, the auto-fix
command is sometimes broken due to this caret. It can be disabled with -fno-diagnostics-show-caret
. This is not a critical bug because this flag can be put in the init.el, however it can be surprising.
Dante with Docker dev container?
How would you recommend using Dante running in a host Emacs on a client docker container? Unfortunately, a lot of the below seems to deal more with haskell-mode than dante.
- GHCi and cabal in the container,
- volumes accessible on host, mounted in container.
Naive approaches have not worked.
- I had partial success with editing
dante-repl-command-line
to attach to a running container, or calldocker exec
. This required mounting my/var
(actually/private/var/folders
Mac OS?) so the container ghci could see all the temp files dante loads. This allows type/info checks only. BTW, why does Dante load temp files, vs the underlying file? - I updated
haskell-process-path-cabal
from the underlying haskell-mode to do the same. This allowedhaskell-compile
to run, but nothaskell-process-cabal-build
or any of the other cabal commands fromhaskell-process-cabal
. This seems to be becausehaskell-load.el:245
directly constructs a local command:(shell-command (concat "cabal " command)
, if there isn't an interactive haskell process running. - I haven't unraveled why changing
haskell-process-path-cabal
to forward throughdocker exec
, likedante-repl
and andhaskell-comple
, simply causes the haskell-session to crash repeatedly... - Using docker-tramp to establish a remote environment to the container chokes on cabal
/bin/sh: 1: cabal: not found
. I'm pretty sure this is because my profile is being overridden.
(tramp-own-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin" "/opt/sbin" "/opt/local/bin")
While tramp-own-remote-path
is supposed to inject profile settings, there are warnings on the tramp site that bin/sh
can't process ~
or export PAR=ARG
syntax.
Overall, however, I think tramp is likely sub-optimal -- I'm compressing and transferring a file from the container to the host, which docker mounted in the container from the host to begin with. It maybe possible to just get the remote shell aspect by editing default-directory
to one that Emacs recognizes as remote, but I'm not sure of the implications there when actually loading files locally on host.
Don’t use `(some)` but `(cl-some)`
You need to
diff --git a/dante.el b/dante.el
index 25f25d4..8c782e1 100644
--- a/dante.el
+++ b/dante.el
@@ -105,7 +105,7 @@ look for a .cabal file, or use the current dir)."
(file-name-directory (or (dante-cabal-find-file) (dante-buffer-file-name)))))
(defun dante-repl-by-file (root files cmdline)
- (some (lambda (file) (when (file-exists-p (concat root file)) cmdline)) files))
+ (cl-some (lambda (file) (when (file-exists-p (concat root file)) cmdline)) files))
(defconst dante-repl-command-line-default-methods
`((styx . ,(lambda (root) (dante-repl-by-file root '("styx.yaml") '("styx" "repl"))))
Suggestion: use "tq" to manage process communication
I don't know if you've seen the tq
library built into Emacs. It's precisely for sending queued messages off to a backend process, waiting for a regexp match, and then returning that match to a callback. I love that you're keeping dante
as simple and minimal as possible, and I feel like tq
could be used to further simplify dante
significantly. I played a little locally, and ended up with a version of dante-async-call
which looks a little like the following:
(defun dante-async-call (cmd cont)
"Send GHCi the command string CMD.
The result is passed to CONT as (CONT REPLY). Can only be called
from a valid session."
(when (memq 'outputs dante-debug) (message "[Dante] -> %s" cmd))
(let ((prompt-re "\4\\(.*\\)|"))
(with-current-buffer (dante-buffer-p)
(tq-enqueue
dante-tq
(concat cmd "\n")
(concat "\\(.*?\\)" prompt-re)
nil
(lambda (_ response)
(let ((reply (car (s-split-up-to prompt-re response 1))))
(when (memq 'responses dante-debug)
(message "[GHCi] <- %S" reply))
(funcall cont cont reply)))
t))))
There, dante-tq
is the result of calling tq-create
on the repl process, as in the following hacked version of dante-start-process-in-buffer
:
(defun dante-start-process-in-buffer (buffer source-buffer)
"Start a Dante worker in BUFFER for SOURCE-BUFFER."
(if (eq (buffer-local-value 'dante-state buffer) 'dead)
buffer
(let* ((args (-non-nil (-map #'eval (dante-repl-command-line))))
(process (with-current-buffer buffer
(when (memq 'command-line dante-debug)
(message "GHCi command line: %s" (combine-and-quote-strings args)))
(message "Dante: Starting GHCi ...")
(apply #'start-file-process "dante" buffer args))))
(set-process-query-on-exit-flag process nil)
(with-current-buffer buffer
(message "Setting transaction queue in %S" buffer)
(setq-local dante-tq (tq-create process))
(erase-buffer)
(setq-local dante-command-line (process-command process)))
(with-current-buffer source-buffer
(set-dante-state 'starting)
(dante-async-call
(concat ":set -Wall\n" ;; TODO: configure
":set +c\n" ;; collect type info
":set prompt \"\\4%s|\"")
(lambda (cont reply) (message "GHCi started!"))))
(set-process-sentinel process 'dante-sentinel)
buffer)))
This is sufficient to get the message GHCi started
, but my tinkering stalled when trying to get my head around the CPS stuff: I'm not sure whether or not that could be eliminated.
can projectile-kill-buffers kill Dante sessions too?
Both Projectile and Dante are really nice, and for the most part, they work nicely together.
I also use emacs in daemon mode to save on startup time. So buffers can sometimes accumulate, and I use projectile-kill-buffers
to clean things up. However, I just noticed that the associated Dante process buffers are staying alive.
My Elisp isn't so strong, but looked at dante-destroy
. It works fine when called manually, but a single projectile session can have multiple Dante process buffers (because of multi-project builds).
So for now, I'm using dante-list-buffers
and killing the buffers interactively from there.
These background processes aren't really that big a deal. They haven't bee consuming that many resources just idling in the background. But I thought it would be nice to have a way to clean them up better. Otherwise, Dante has integrated into my workflow super nicely (thanks for that).
Feature Request: Auto complete for language pragmas
Remembering how to spell language pragmas sucks. Ghc-mod has this so I know it's possible.
No completions for dependencies
Hi,
I have a problem getting company completions working for packages other than base
. I'm working on a small nix-based example, with shell.nix
, default.nix
and a .dir-locals.el
site which sets dante-project-root
to the project directory.
My cabal file looks like this:
name: hs
version: 0.1.0.0
-- synopsis:
-- description:
license: BSD3
license-file: LICENSE
author: Karsten Gebbert
maintainer: [email protected]
-- copyright:
-- category:
build-type: Simple
extra-source-files: ChangeLog.md
cabal-version: >=1.10
executable hs
main-is: Main.hs
-- other-modules:
-- other-extensions:
build-depends: base >=4.1 && <4.20
,aeson
,bytestring
,text
,binary
-- hs-source-dirs:
default-language: Haskell2010
and the corresponding generated (cabal2nix) derivation:
{ mkDerivation, aeson, base, binary, bytestring, stdenv, text }:
mkDerivation {
pname = "hs";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ aeson base binary bytestring text ];
license = stdenv.lib.licenses.bsd3;
}
The project builds fine both, using nix and cabal in a nix-shell, and when I run nix-shell --run "cabal repl"
it allows me to import e.g. Data.Binary.Get
. So everything works as expected. However, when I try to complete a symbol like get<tab>
using company, it only offers getChar
, getContents
and getLine
, but not getWord8
.
I set up dante itself exactly as per instructions in the README.
Is there anything obvious I might have overlooked that could lead to this problem?
Thank you for any hints, and for this otherwise great mode/code!
k
ps: I should add I'm using dante Version: 20171201.523
Multiple instance declarations errors are not reported when the 1st instance is defined in another module
This is due to GHCi locating the error in the other module. Consequently flycheck won't display it.
Maintaining state between `dante-eval-block` uses; multi-line evaluations?
It's not clear to me how this feature is supposed to work:
{-> :set +t
-}
{-> let a = 1
a :: Num a => a
-}
{-> a
<interactive>:94:1: Not in scope: ‘a’
-}
For clarity, I'm running quite a mongrel session; let me know if any of the behavior listed is contrary to your experience, and I'll troubleshoot my environment. (For reference if needed: cabal 1.22 project, spacemacs on OSX, build environment in docker haskell container running GHC 7.10.1. My command to get this running is: (dante-repl-command-line . ("sudo" "-E" "-u" "auser" "-s" "bash" "-i" "-c" "cd projroot && cabal repl --ghc-options='-ferror-spans'"))
, which is setup by a .dir-locals.el
file in the repo I'm working on.)
- Is this lack of state supposed to happen, or particular to my configuration?
- Is there any way to run multiple lines?
- Is there any integration with
haskell-interactive-bring
fromhaskell.el
? These seem to be two completely different sessions in my config. - Is there someway to bring up the dante repl session to watch what's happening?
dante-list-buffers
doesn't show it -- should it? - How can one bring in other context or imports for testing and troubleshooting? eg:
{-> :add *Main ...}
{-> :show modules
Service.Module.Types ( /var/folders/px/h7c3bvhd5j78hk34lsjc1gjc0000gp/T/danteKZSsC5.hs, interpreted )
Service.Module.Error.Types ( src/Service/Module/Error/Types.hs, dist/build/schmods-api/schmods-api-tmp/Service/Module/Error/Types.o )
-}
-- all the modules have disappeared from context
the use of temporary files causes ambiguities which cause some context changes to fail
{-> :add *Service.Module *Service.Module.Types *Project.Operations.Module *Project.Data.Module.Conversions *Project.REPL *Data.Time.Helpers
<no location info>:
module ‘main@main:Service.Module.Types’ is defined in multiple files: /var/folders/px/h7c3bvhd5j78hk34lsjc1gjc0000gp/T/danteKZSsC5.hs
/var/folders/px/h7c3bvhd5j78hk34lsjc1gjc0000gp/T/danteKZSsC5.hs
Failed, modules loaded: Service.Module.Types, Service.Module.Error.Types.
-}
Am I just misusing this feature? Here's the scenario: I'm attempting to modify data types and Aeson serialization incrementally. Any change to the types breaks a lot of helper functions, preventing the file from loading. I'd like to test just the data type and fromJSON
instances I'm changing, then go edit the helper functions, piece by piece by piece.
Company completion
It'd be nice to have company-mode autocompletion. I believe this is possible with GHCi, right?
Company completion breaks flycheck
Steps to reproduce:
- Enable dante-mode, company-mode and flycheck in a .hs buffer
- Start typing on a blank line, with regular pauses, such that both
flycheck
andcompany
are being triggered in quick succession, e.g.dfa f kjklj adf a sdf asdf sd f dfasd fdfsdfs sdfasfdadfffd jlasdfjl
. Sometimes it's necessary to do this for a while until the "actual result" below is obtained.
Expected result:
- Flycheck continues to update the in-buffer errors
Actual result:
- Flycheck stops working, even after typing has finished.
- Flycheck appears to be in the "running" state.
dante-restart
must be called to restore functionality.
My guess is that some constellation of overlapping requests and conditions causes the flycheck checker's callback to not be called, leaving the check stuck. With company
disabled, this does not happen.
(My company-minimum-prefix-length
is 3, and flycheck triggers lazily, ie. is not set to only trigger on save/newline.)
Background: I'm one of the intero contributors, but I'm keen to adopt a solution with fewer moving parts, so I've been trying out dante in the last couple of days. This is really the only blocker for me.
I was playing with the dante
code a little, and will file a separate issue with a suggestion that might be helpful to you.
Thanks!
GHC 8.2.2 and the newest -Wmissing-home-modules
Hello!
We’re using -Werror -Wall
for compilation and, on 8.2.2, when loading (:l
) a file from /tmp/
, which Dante does, the following happens:
λ> :l /tmp/blah1234.hs
<no location info>: warning: [-Wmissing-home-modules]
These modules are needed for compilation but not listed in your .cabal file's other-modules:
[ … a list of all modules in the project … ]
<no location info>: error:
Failing due to -Werror.
Failed, no modules loaded.
(0.05 secs,)
λ>
An (ugly?) workaround is to add -Wwarn=missing-home-modules
in the Cabal file, e.g.:
library
ghc-options: -Wall -Werror -Wwarn=missing-home-modules [ … other options … ]
This way, the missing-home-modules
stays a warning in spite of -Werror
, and Dante is usable.
Another option would be to use -Wno-missing-home-modules
, to make GHCi less chatty (without -Wno-…
, for each reload it dumps the whole module list, but as a warning).
Feature request: Insert import
This is another thing ghc-mod has now I really wish was there in Dante. Basically, you can highlight a symbol, and ask to insert the import for that symbol. This would be a 2 stage interaction, as that symbol may be in more than one module, and the developer must choose.
Go to definition not working
I always get something like this:
No defintions found for "/tmp/dante-asalewkrjew.hs" ...
Feature Request: Autocomplete for imports
The title says it. It would be nice to gain discoverability into imports.
autofix non-exhaustive pattern matches.
I'm utterly failing at customising the dante-auto-fix
regex to add support for this error
[-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In a case alternative: Patterns not matched: (Blah _)
any tips for how the regex works in dante would be appreciated.
Completion works for the current module only if it can be loaded.
The completions (almost) never return a result. The moment one types something, there are inevitable errors in the buffer, and GHCi won't load it. Thus it won't produce the expected company completions; only those from Prelude.
(I am paraphrasing @purcell above)
A possible (partial) workaround is to add -fdefer-type-errors
to dante-load-flags
. This way even work if the code won't typecheck GHCi will load the buffer. However, one will be bitten by #52
`bare` method init failure: cabal: Unrecognised build target ''
Dante fails to start cabal repl
, even though I can do it manually.
The key error message looks like it is cabal: Unrecognised build target ''
Facts
- emacs is
25.1.1
- dante is
20170207.234
(Melpa) - cabal is
1.24.0.2
haskell-mode-hook
has both(dante-mode +1)
and(flycheck-mode +1)
- opening a source file yields this:
This where GHCi output is bufferized. This buffer is normally hidden,
but a problem occcured.
EXTRA TROUBLESHOOTING INFO
The GHCi process ended. Here is the reason that Emacs gives us: exited abnormally with code 1
Directory:/home/deepfire/holotype/
Command line:(cabal repl )
Loaded:
State: dead
Queue: nil
Callback: #[128 \302\300\303\301�""\207 [dante-wait-for-prompt (Flatland.hs :set -Wall
:set +c
:set prompt "\4%s|" cabal: Unrecognised build target ''.
Examples:
- build foo -- component name (library, executable, test-suite or benchmark)
- build Data.Foo -- module name
- build Data/Foo.hsc -- file name
- build lib:foo exe:foo -- component qualified by kind
- build foo:Data.Foo -- module qualified by component
- build foo:Data/Foo.hsc -- file qualified by component
#[257 \301\302!\210\303\300!\207 [ dante:holotype: /home/deepfire/holotype/ message GHCi started! dante-schedule-next] 3
(fn START-MESSAGES)]) apply append] 6
(fn &rest ARGS2)]
WHAT TO DO NEXT
Try to customize (probably file or directory-locally)
`dante-project-root' and/or `dante-repl-command-line'. If you
fixed the problem, just kill this buffer, Dante will make a fresh
one and attempt to restart GHCi automatically.
If you are unable to fix the problem, just leave this buffer
around and Dante will not attempt to restart GHCi.
You can always run M-x dante-restart to make it try again.
Observations
Directory
from above log looks right, althoughdante-project-root
isnil
in the source buffer- Running
cabal repl
manually properly starts building the project:
deepfire@andromedae:~/holotype$ cabal repl
Preprocessing library holotype-0.0.1...
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/deepfire/.ghci
[ 1 of 14] Compiling Reflex.Random ( src/Reflex/Random.hs, interpreted )
[ 2 of 14] Compiling Reflex.GLFW ( src/Reflex/GLFW.hs, interpreted )
[ 3 of 14] Compiling HoloSys ( src/HoloSys.hs, interpreted )
[ 4 of 14] Compiling HoloCairo ( src/HoloCairo.hs, interpreted )
[ 5 of 14] Compiling Elsewhere ( src/Elsewhere.hs, interpreted )
[ 6 of 14] Compiling Data.MeasuredMonoid ( src/Data/MeasuredMonoid.hs, interpreted )
[ 7 of 14] Compiling Flatland ( src/Flatland.hs, interpreted )
src/Flatland.hs:402:1: warning: [-Wincomplete-patterns]
Pattern match(es) are non-exhaustive
In an equation for ‘computeRequires’:
Patterns not matched: (CF _ (CGrid _ _))
[ 8 of 14] Compiling FlatDraw ( src/FlatDraw.hs, interpreted )
src/FlatDraw.hs:118:40: error:
Not in scope: type constructor or class ‘S’
src/FlatDraw.hs:118:42: error:
Not in scope: type constructor or class ‘Wrap’
src/FlatDraw.hs:119:28: error:
Not in scope: data constructor ‘Pwrap’
src/FlatDraw.hs:120:11: error:
Not in scope: data constructor ‘Parea’
Failed, modules loaded: Data.MeasuredMonoid, Elsewhere, Flatland, HoloCairo, HoloSys, Reflex.GLFW, Reflex.Random.
*Data.MeasuredMonoid Text.Printf>
Leaving GHCi.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.