r/dailyprogrammer • 1 3 • Aug 18 '14

[Weekly #7] Programming Tools -- The Editors

Weekly 7:

For the most part at the core of programming you need a text editor. Then you might run your program through a compiler/linker/etc. Over time we have been merging these into 1 program. So now you edit your program and link your libraries in and compile it and debug your program all in one nice program.

What are your development tools/process? Are they language dependent? What are some tools that you don't use often but would like to give a shout out too with a link for people to see?

Last Week's Topic:

[Weekly #6] (http://www.reddit.com/r/dailyprogrammer/comments/2d957i/weekly_6_python_tips_and_tricks/)

61 Upvotes

94 comments sorted by

View all comments

Show parent comment

1

u/ralleMath Aug 19 '14

Thank you for the offer.

If you feel like answering a quick question I'm wondering whether there's a quick way of enabling auto-complete, preferably with tab, without going into stuff like cabal files. When searching I get plenty of guides but they all appear to require me to either do a bunch of stuff I don't understand or spend several hours learning things like just what cabal files are. Which is a little frustrating when I just want to code for awhile.

3

u/ruicoder Aug 20 '14 edited Aug 20 '14

Cabal is pretty much the defacto package manager for installing third party libraries. If you're familiar with Python, then it serves the same function as pip.

For autocompletion I use company, which can be installed via emacs' package manager. auto-complete is another one that's popular.

I would recommend company. For Haskell, company (and auto-complete) alone will only provide local completions (i.e., anything that exists in the buffer can be autocompleted). If you want more than that than you need to install ghc-mod via cabal and then install company-ghc via emacs' package manager.

To give a clear list of steps:

  1. In emacs, run M-x package-install, hit ENTER, write company, hit ENTER.
  2. In your .emacs or init.el, add the following:

     (require 'company)
     (add-hook 'after-init-hook 'global-company-mode)
  3. Install cabal.
  4. Run cabal update from the command line.
  5. Run cabal install ghc-mod from the command line.
  6. In your .emacs or init.el, add the following:

     (add-to-list 'exec-path "~/.cabal/bin")
     (autoload 'ghc-init "ghc" nil t)
     (autoload 'ghc-debug "ghc" nil t)
     (add-hook 'haskell-mode-hook (lambda () (ghc-init)))
  7. Install company-ghc the same way you installed company.
  8. Add the following to your .emacs or init.el:

     (add-to-list 'company-backends 'company-ghc)

Anything past the second step is unecessary if you just need buffer-local completion.