
Intero for Emacs: complete interactive development program for Haskell - primodemus
https://commercialhaskell.github.io/intero/
======
mark_l_watson
I saw this notice on Reddit early yesterday morning and ended up using Intero
for most of the day. Love it! There are a lot of improvements over and above
the Emacs Haskell mode. I really like how fast it is to control-c-l and be put
n the correct module and be running in seconds. I also like the realtime
syntax error hints, type information, etc.

------
cm3
There should be a warning that on first start of intero-mode, this will
initiate a rather long stack operation, which I suppose is extra long if you
hadn't used stack before. Also, it seems to insist on a stack'ised project.
But I suppose one could say that should be obvious. I use cabal because stack
misses some features and is a little weird and use stack when I have to. And
even though I have intero installed and in $PATH, when opening an actual
project with a stack file, it start building intero. Weird automatism.

~~~
psibi
What features do you think stack misses ?

~~~
cm3
* split-objects to create much smaller binaries. In cabal it's a single line in its global config file.

* Using my already available GHC builds, because stack's GHC builds do not work everywhere, not even across all Linux distros. If I have a musl-based Linux distro, FreeBSD, or Solaris it'll be a problem. Also, there are many users who prefer to use other builds than those downloaded via stack. This happens even if there is already the right GHC in PATH by default.

* I like cabal's new new-foo features and project file support.

* Not bailing out if I open a random .hs file where there's no associated stack config. In a sibling comment Chris says he wants it to work automagically, but then it should create a global stack file, which he says will be used if available.

* Offline mode.

* I will find more stuff I miss, once I have used stack more.

------
jesserosenthal
This looks great! My only complaint is that sometimes I do want to work on a
quick script outside of a stack environment, and this seems like an all-or-
nothing proposition. (I use haskell for pandoc filters quite a bit, for
example, and setting up stack for that seems like overkill.) I'm sure a bit of
elisp could make it fall back to haskell mode if it can't find a local .stack
dir.

~~~
chrisdone
If there's no stack.yaml it uses the global ~/.stack/global/stack.yaml.

So you should be able to open any random file and it'll work out. E.g. if I
open ~/X.hs and import Lucid, I can just run stack build lucid in my ~/ and
now M-x intero-restart and it has access to that package.

------
avindroth
Haskell changed my life. Then Intero did it again.

------
pash
I've been waiting for this release before finally trying to switch from Vim
(MacVim) to Spacemacs. Anybody have any tips for somebody who's never really
used Emacs?

~~~
Steeeve
I had used IDE's, windows based text editors like UltraEdit, and vi/vim for
the longest time before I decided it was time to go back to Emacs. I dedicated
two weeks to using it almost exclusively to pick up the muscle memory of major
keybindings. I haven't looked back since.

The keys I really needed out of the gate:

* F3/F4 - building macros, then C-x e to execute (after that, just plain e)

* C-s - search

* M-s o - occur (you define a regular expression, it lists all the lines that match it, so something like `def ( _` for python functions

_ C-v/M-v - page up/page down

* C-f/C-b - forward and back character

* M-f/M-b - forward and back word

* C-/ \- undo

* M-w - copy

* C-y - paste

* C-o - open new line

* M-z - zap-to-character (try it, it's awesome)

* C-M-e / C-M-h - beginning/end of function

* C-a / C-e - beginning/end of line

* C-l - center window on cursor

* C-[space] - mark cursor / unmark cursor

* C-d/M-D - delete char/word

* C-k - kill line

* M-/ \- autocomplete word (works in any file, any language, and cycles through suggestions on repeated calls) ... Those and then getting yasnippet installed and working was probably the most important plugin. It's real simple templates for any language and there are a lot of decent default ones. (so for instance, you type html, then tab and it'll build a basic html file for you and put your cursor in the <head> tag, or def, then tab and you have a structured function definition and your cursor stops where the name goes, tab again it puts it in the parameters, tab again, docstring, tab again, coding area).

If you dedicate two weeks to it, you'll begin to see the power that everyone
talks about. The first day or two will be frustrating because even the basics
I just listed are a pain to remember out of the gate, let alone have the
muscle memory to do without thinking.

~~~
mijoharas
This list seems really useful for general emacs, but does not help for
spacemacs which has it's own equivalents (with vim-ey keybindings). I've been
using spacemacs for a few years as my editor every day, and have not needed
any of these.

~~~
Steeeve
Ahh - thanks. I'm not a spacemacs user. In my mind I had that associated with
one of those OSX specific builds for some reason.

------
gravypod
I wish I could get a similar utility for Python and Javascript as this seems
to show off some cool FP auto complete.

I'm basically looking for a way to remove my dependency on my 5-7 IDEs and I
don't know how. I wish someone could show me a very good, simple, alternative
to all of them. I work in C, Java, JavaScript, Python, PHP, and C# and I'd
like to be able to use a single IDE solution for all of them. Sadly I cant
find anything with good auto completion and nice features (like things offered
by Eclipse).

This has some really promising features, I've got to say I'm amazed.

~~~
mdadm
> Sadly I cant find anything with good auto completion and nice features (like
> things offered by Eclipse).

Out of curiosity, have you tried the relevant JetBrains IDE(s)?

~~~
wcummings
eclim is the best you're gunna do for Java in Emacs I think, and it's
realllllllllly slow.

~~~
pjmlp
I never understood why running a full Eclipse as sub-process instead of just
using Eclipse.

------
seagreen
Looks like I've got a choice to make (all on NixOS):

\+ Stick with NeoVim and hope one of the Intero ports to that editor takes off
(as I understand it there are a couple right now)

\+ Switch to Emacs+Evil+Intero. I've never used Emacs before (even with Evil)
so it would be a little work.

If someone more up-to-date on the situation has advice that would be awesome:)

~~~
xdc55
I'm a emacs convert from vim (big reason is because module support is just
leagues ahead of vim, Vundle, Pathogen, or anything else don't come close to
emacs package management). A huge reason why I stuck with it is because evil.
evil is very mature and is incredibly close to vim, some say it's a better vim
than vim.

I tried a lot of "vi modes" in several IDEs but none of them cut it, you can
map anything to evil and you can, of course, map commands to different states.
Something I found very usefil is that you can even set states for different
buffers, for example, for magit buffers (another amazing emacs module and a
very good reason to use emacs) I default those to "insert" mode.

I haven't used Intero myself, but I've yet to find any kind of conflict
between evil or any other module.

~~~
MichaelGG
Evil seems to get some things wrong or weird. If I use the mouse, then using .
to repeat last edit doesn't work. I've also had issues using macros sometime.

It also seems to have severe performance issues. Maybe it's Emacs, or rust-
mode. But, say, running a macro 1000 times on a 10K line file is far slower
than using vim.

But overall it's pretty great. I have the feeling it's easier to configure,
once I get familiar with Emacs/elisp.

~~~
minikomi
For what it's worth, I've had trouble with macros as well. Sometimes they run
at a glacial pace. Very strange.

------
oggy
It didn't "just work (TM)" for me, I had to customize the intero-package-
version in my .emacs when using it with a project with the latest stack-
nightly, to bump it up to "0.1.16".

But other than that, wow! I was already very happy whenever I could get ghc-
mod and haskell-mode to work, but this takes the responsiveness to a whole
different level.

------
patrec
Very nice! But is there currently no way to get any information about third
party code other than the type signature (C-c C-t or C-C C-i)? Ideally I'd
like to be able to both navigate to the source code and see the documentation.

It might also be good to mention that you need to apt-get install
libcurses5-dev for the haskell code to build.

------
icc97
Wonderful package. Works nicely on Windows too [1].

    
    
      [1]: https://ianchanning.wordpress.com/2016/08/11/installing-haskell-emacs-on-windows/

------
pjmlp
I rather use Leksah ([http://leksah.org/](http://leksah.org/)), but it is nice
to see other options available.

