Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save androidfred/a2bef54310c847f263343c529d32acd8 to your computer and use it in GitHub Desktop.
Save androidfred/a2bef54310c847f263343c529d32acd8 to your computer and use it in GitHub Desktop.

Revisions

  1. androidfred revised this gist Dec 3, 2017. 1 changed file with 2 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,8 @@ Upon completion you will have a sane, productive Haskell environment adhering to
    * Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
    * Intellij IDEA IDE is a popular IDE.

    ## Install libtinfo-dev
    `sudo apt-get install libtinfo-dev`
    ## Install required libraries
    `sudo apt-get install libtinfo-dev libghc-zlib-dev libghc-zlib-bindings-dev`

    ## Download and extract Stack
    Don't install Haskell, Stack, Cabal or any other Haskell tool or library using your OS package manager or using Cabal.
  2. androidfred revised this gist Mar 30, 2017. 1 changed file with 0 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,6 @@
    # Haskell, Stack and Intellij IDEA IDE setup tutorial how to get started
    Upon completion you will have a sane, productive Haskell environment adhering to best practices.

    NOTE: This gist sometimes gets a bit outdated. The current instructions on https://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and https://github.com/rikvdkleij/intellij-haskell are pretty good, check them out.

    ## Basics
    * Haskell is a programming language.
    * Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
  3. androidfred revised this gist Mar 30, 2017. 1 changed file with 10 additions and 5 deletions.
    Original file line number Diff line number Diff line change
    @@ -34,9 +34,9 @@ stack install hindent stylish-haskell
    ```
    to install tools required by the IDE plugin for Haskell. (they will be installed to `~/.local/bin`)
    * Download and Intellij IDEA IDE from http://www.jetbrains.com/idea and extract it to some appropriate folder.
    * Start IntelliJ up and install the plugin `Intellij-Haskell`. (**NOTE** there are a number of different mutually exclusive Haskell plugins. If other Haskell plugins are already installed, uninstall them before installing the `Intellij-Haskell` plugin)
    * (**NOTE** there are a number of different mutually exclusive Haskell plugins. If other Haskell plugins are already installed, uninstall them before installing the `Intellij-Haskell` plugin) Start IntelliJ up and install the plugin `Intellij-Haskell`. (The plugin will install its own copies of Intero and Hlint)
    * Restart IntelliJ.
    * `Settings` | `Other` | `Haskell` | add the respective paths to the tools (eg for `hlint` `~/.local/bin/hlint`)
    * `Settings` | `Other` | `Haskell` | add the respective paths to the tools (eg for `hindent` `~/.local/bin/hindent`)
    * File | New | Project from Existing Sources | in the New Project wizard select Import project from external module and check Haskell Stack
    * In next page of wizard configure Project SDK by configuring Haskell Tool Stack with selecting path to stack binary, e.g. `/usr/local/bin/stack`
    * Finish wizard and project will be opened.
    @@ -65,12 +65,17 @@ One of the advantages of Haskell is the interactive interpreter. Go to `path to
    ```bash
    stack ghci
    ```
    to fire up the interpreter, then
    to fire up the interpreter. The Main module and other project modules should be automatically loaded. With the modules loaded, inside the interpreter, run
    ```bash
    :load Main
    main
    ```
    to interactively load the Main module and call the main function. New functions can also be defined and tried out interactively. It's a faster development flow than writing the source code in the source code files and building and running the project all the time.
    to interactively call the main function.

    New functions can be defined and tried out interactively inside the interpreter. When editing source files, run
    ```bash
    :r
    ```
    inside the interpreter to reload them. (**NOTE** reloading edited source files into the interpreter does only that- rebuilding the project is still necessary to reflect source file edits in the built project)

    ### Updating Haskell and Stack
    Stack can install and manage multiple Haskell versions, and different versions of different libraries in different projects. Stack itself can be upgraded to the latest version simply by running
  4. androidfred revised this gist Mar 25, 2017. 1 changed file with 4 additions and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -8,8 +8,11 @@ NOTE: This gist sometimes gets a bit outdated. The current instructions on https
    * Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
    * Intellij IDEA IDE is a popular IDE.

    ## Install libtinfo-dev
    `sudo apt-get install libtinfo-dev`

    ## Download and extract Stack
    Don't install Haskell, Stack, Cabal or any other Haskell tool or library using your OS package manager or using Cabal.
    Don't install Haskell, Stack, Cabal or any other Haskell tool or library using your OS package manager or using Cabal.

    Instead, download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to `$PATH`. (adding a folder to `$PATH` is beyond the scope of this tutorial, search and you will find)

  5. androidfred revised this gist Mar 25, 2017. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #Haskell, Stack and Intellij IDEA IDE setup tutorial how to get started
    # Haskell, Stack and Intellij IDEA IDE setup tutorial how to get started
    Upon completion you will have a sane, productive Haskell environment adhering to best practices.

    NOTE: This gist sometimes gets a bit outdated. The current instructions on https://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and https://github.com/rikvdkleij/intellij-haskell are pretty good, check them out.
  6. androidfred revised this gist Mar 25, 2017. 1 changed file with 18 additions and 8 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    #Haskell, Stack and Intellij IDEA IDE setup tutorial how to get started
    NOTE: Currently a bit outdated, hopefully I'll find time to update soon. (pull requests would be welcome too) The current instructions on https://github.com/rikvdkleij/intellij-haskell are pretty good, check them out.

    Upon completion you will have a sane, productive Haskell environment adhering to best practices.

    NOTE: This gist sometimes gets a bit outdated. The current instructions on https://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and https://github.com/rikvdkleij/intellij-haskell are pretty good, check them out.

    ## Basics
    * Haskell is a programming language.
    * Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
    @@ -27,16 +27,26 @@ Stack installs Haskell (ghc) to `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin/g
    ## IDE
    * Make sure you're not inside a Haskell project folder and run
    ```bash
    stack install hlint stylish-haskell ghc-mod
    stack install hindent stylish-haskell
    ```
    to install tools required by the IDE plugin for Haskell. (they will be installed to `~/.local/bin`)
    * Download and Intellij IDEA IDE from http://www.jetbrains.com/idea and extract it to some appropriate folder.
    * Start IntelliJ up and install the plugin `Intellij-Haskell`. (**NOTE** there are a number of different mutually exclusive Haskell plugins- they can't be installed simultaneously. If other Haskell plugins are already installed, uninstall them before installing the `Intellij-Haskell` plugin)
    * Start IntelliJ up and install the plugin `Intellij-Haskell`. (**NOTE** there are a number of different mutually exclusive Haskell plugins. If other Haskell plugins are already installed, uninstall them before installing the `Intellij-Haskell` plugin)
    * Restart IntelliJ.
    * `Settings` | `Other` | `Haskell` | add the respective paths to the tools (eg for `ghc-mod` `~/.local/bin/ghc-mod`)
    * `File` | `New` | `Project` | select `Haskell module` and tick the Haskell box | `Next` | create GHC SDK using path to GHC binaries `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin` | `Project name`: `my-project`, `Project location`: `path to root of my-project`
    * `Tools` | `Add Haskell package dependencies`. **This is what enables viewing docs while coding.** It creates a folder `ideaHaskellLib` in which it runs `stack unpack` for every dependency output by `stack list-dependencies`. **Remember to repeat this step on any change in dependencies.** Add the `ideaHaskellLib` folder to the `.gitignore` file for the project (it's not part of your projects source code).
    * `Project Structure` | `Modules` | mark `ideaHaskellLib`, `app` and `src` as `Sources`, `test` as `Tests`.
    * `Settings` | `Other` | `Haskell` | add the respective paths to the tools (eg for `hlint` `~/.local/bin/hlint`)
    * File | New | Project from Existing Sources | in the New Project wizard select Import project from external module and check Haskell Stack
    * In next page of wizard configure Project SDK by configuring Haskell Tool Stack with selecting path to stack binary, e.g. `/usr/local/bin/stack`
    * Finish wizard and project will be opened.

    Wizard will try to automatically configure which folders are sources, test and which to exclude. Plugin will automatically build Intero and HLint to prevent incompatibility issues (If you use non LTS or Nightly resolver e.g. ghc-7.10.2, you may have to build them manually since there are some extra-deps should be added to stack.yaml). Those tools are built against Stackage release defined in project's stack.yaml. If you want to use later version of tool, you will have to build tool manually in project's folder by using stack build.

    * Check Project structure/Project settings/Modules which folders to exclude (like .stack-work and dist) and which folders are Source and Test. (normally src and test)

    Plugin will automatically download library sources (since Stack version 1.2.1 also for test dependencies). They will be added as source libraries to module. This option gives you nice navigation features through libraries. Sources are downloaded to folder .ideaHaskellLib inside root of project. After changes to dependencies you can download them again by using `Tools` | `Download Haskell Library Sources`. **This is what enables viewing docs while coding.** It creates a folder `ideaHaskellLib` in which it runs `stack unpack` for every dependency output by `stack list-dependencies`. **Remember to repeat this step on any change in dependencies.**

    * Add the `ideaHaskellLib` folder to the `.gitignore` file for the project (it's not part of your projects source code).

    In the background for each Haskell project two Stack repls are running. You can restart them by Tools/Restart Haskell Stack REPLs. When you make large changes to stack.yaml or Cabal file, you have to restart IntelliJ project.

    Most or all of the usual features of Intellij like auto-completion, go to declaration `ctrl+b` etc should now work.

  7. androidfred revised this gist Mar 10, 2017. 1 changed file with 2 additions and 0 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    #Haskell, Stack and Intellij IDEA IDE setup tutorial how to get started
    NOTE: Currently a bit outdated, hopefully I'll find time to update soon. (pull requests would be welcome too) The current instructions on https://github.com/rikvdkleij/intellij-haskell are pretty good, check them out.

    Upon completion you will have a sane, productive Haskell environment adhering to best practices.

    ## Basics
  8. androidfred revised this gist May 25, 2016. 1 changed file with 2 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -58,9 +58,9 @@ main
    to interactively load the Main module and call the main function. New functions can also be defined and tried out interactively. It's a faster development flow than writing the source code in the source code files and building and running the project all the time.

    ### Updating Haskell and Stack
    Stack can install and manage multiple Haskell versions, and different versions of different libraries in different projects. Stack itself can be updated simply by running
    Stack can install and manage multiple Haskell versions, and different versions of different libraries in different projects. Stack itself can be upgraded to the latest version simply by running
    ```bash
    stack update
    stack upgrade
    ```
    This is why neither Haskell, Stack, Cabal nor any other Haskell tool or library should be installed and managed through the OS package manager or Cabal. (anything installed and managed through the OS package manager will be a single, global version, and the versions are often lagging severely)

  9. androidfred revised this gist May 20, 2016. 1 changed file with 0 additions and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,6 @@ Terminal has to be used for this. Go to `path to root of my-project` and run
    ```bash
    stack build && stack exec my-project-exe
    ```
    If the IntelliJ terminal can't find `stack`, add `~/.local/bin` to `$PATH` in `.bashrc` and create a new Intellij terminal instance, it should work.
    #### Interactive interpreter
    One of the advantages of Haskell is the interactive interpreter. Go to `path to root of my-project` and run
    ```bash
  10. androidfred revised this gist May 19, 2016. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -29,7 +29,7 @@ stack install hlint stylish-haskell ghc-mod
    ```
    to install tools required by the IDE plugin for Haskell. (they will be installed to `~/.local/bin`)
    * Download and Intellij IDEA IDE from http://www.jetbrains.com/idea and extract it to some appropriate folder.
    * Start IntelliJ up and install the plugin `Intellij-Haskell`. (NOTE there are a number of different mutually exclusive Haskell plugins- they can't be installed simultaneously. If other Haskell plugins are already installed, uninstall them before installing the `Intellij-Haskell` plugin)
    * Start IntelliJ up and install the plugin `Intellij-Haskell`. (**NOTE** there are a number of different mutually exclusive Haskell plugins- they can't be installed simultaneously. If other Haskell plugins are already installed, uninstall them before installing the `Intellij-Haskell` plugin)
    * Restart IntelliJ.
    * `Settings` | `Other` | `Haskell` | add the respective paths to the tools (eg for `ghc-mod` `~/.local/bin/ghc-mod`)
    * `File` | `New` | `Project` | select `Haskell module` and tick the Haskell box | `Next` | create GHC SDK using path to GHC binaries `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin` | `Project name`: `my-project`, `Project location`: `path to root of my-project`
  11. androidfred revised this gist May 19, 2016. 1 changed file with 2 additions and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -41,10 +41,11 @@ Most or all of the usual features of Intellij like auto-completion, go to declar
    ## MISC
    ### Development flow
    #### Build and run the project
    Terminal has to be used for this. (if the IntelliJ terminal can't find `stack`, add `~/.local/bin` to `$PATH` in `.bashrc` and create a new Intellij terminal instance)
    Terminal has to be used for this. Go to `path to root of my-project` and run
    ```bash
    stack build && stack exec my-project-exe
    ```
    If the IntelliJ terminal can't find `stack`, add `~/.local/bin` to `$PATH` in `.bashrc` and create a new Intellij terminal instance, it should work.
    #### Interactive interpreter
    One of the advantages of Haskell is the interactive interpreter. Go to `path to root of my-project` and run
    ```bash
  12. androidfred revised this gist May 19, 2016. 1 changed file with 7 additions and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -33,13 +33,19 @@ to install tools required by the IDE plugin for Haskell. (they will be installed
    * Restart IntelliJ.
    * `Settings` | `Other` | `Haskell` | add the respective paths to the tools (eg for `ghc-mod` `~/.local/bin/ghc-mod`)
    * `File` | `New` | `Project` | select `Haskell module` and tick the Haskell box | `Next` | create GHC SDK using path to GHC binaries `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin` | `Project name`: `my-project`, `Project location`: `path to root of my-project`
    * `Tools` | Add Haskell package dependencies. **This is what enables viewing docs while coding.** It creates a folder `ideaHaskellLib` in which it runs `stack unpack` for every dependency output by `stack list-dependencies`. **Remember to repeat this step on any change in dependencies.** Add the `ideaHaskellLib` folder to the `.gitignore` file for the project (it's not part of your projects source code).
    * `Tools` | `Add Haskell package dependencies`. **This is what enables viewing docs while coding.** It creates a folder `ideaHaskellLib` in which it runs `stack unpack` for every dependency output by `stack list-dependencies`. **Remember to repeat this step on any change in dependencies.** Add the `ideaHaskellLib` folder to the `.gitignore` file for the project (it's not part of your projects source code).
    * `Project Structure` | `Modules` | mark `ideaHaskellLib`, `app` and `src` as `Sources`, `test` as `Tests`.

    Most or all of the usual features of Intellij like auto-completion, go to declaration `ctrl+b` etc should now work.

    ## MISC
    ### Development flow
    #### Build and run the project
    Terminal has to be used for this. (if the IntelliJ terminal can't find `stack`, add `~/.local/bin` to `$PATH` in `.bashrc` and create a new Intellij terminal instance)
    ```bash
    stack build && stack exec my-project-exe
    ```
    #### Interactive interpreter
    One of the advantages of Haskell is the interactive interpreter. Go to `path to root of my-project` and run
    ```bash
    stack ghci
  13. androidfred revised this gist May 19, 2016. 1 changed file with 2 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -31,10 +31,10 @@ to install tools required by the IDE plugin for Haskell. (they will be installed
    * Download and Intellij IDEA IDE from http://www.jetbrains.com/idea and extract it to some appropriate folder.
    * Start IntelliJ up and install the plugin `Intellij-Haskell`. (NOTE there are a number of different mutually exclusive Haskell plugins- they can't be installed simultaneously. If other Haskell plugins are already installed, uninstall them before installing the `Intellij-Haskell` plugin)
    * Restart IntelliJ.
    * `Settings` | `Other` | `Haskell` | add the respective paths to the tools (eg for ghc-mod `~/.local/bin/ghc-mod`)
    * `Settings` | `Other` | `Haskell` | add the respective paths to the tools (eg for `ghc-mod` `~/.local/bin/ghc-mod`)
    * `File` | `New` | `Project` | select `Haskell module` and tick the Haskell box | `Next` | create GHC SDK using path to GHC binaries `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin` | `Project name`: `my-project`, `Project location`: `path to root of my-project`
    * `Tools` | Add Haskell package dependencies. **This is what enables viewing docs while coding.** It creates a folder `ideaHaskellLib` in which it runs `stack unpack` for every dependency output by `stack list-dependencies`. **Remember to repeat this step on any change in dependencies.** Add the `ideaHaskellLib` folder to the `.gitignore` file for the project (it's not part of your projects source code).
    * `Project Structure` | `Modules` | mark `ideaHaskellLib`, `app` and `src` as Sources, `test` as Tests.
    * `Project Structure` | `Modules` | mark `ideaHaskellLib`, `app` and `src` as `Sources`, `test` as `Tests`.

    Most or all of the usual features of Intellij like auto-completion, go to declaration `ctrl+b` etc should now work.

  14. androidfred revised this gist May 19, 2016. 1 changed file with 2 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -33,8 +33,8 @@ to install tools required by the IDE plugin for Haskell. (they will be installed
    * Restart IntelliJ.
    * `Settings` | `Other` | `Haskell` | add the respective paths to the tools (eg for ghc-mod `~/.local/bin/ghc-mod`)
    * `File` | `New` | `Project` | select `Haskell module` and tick the Haskell box | `Next` | create GHC SDK using path to GHC binaries `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin` | `Project name`: `my-project`, `Project location`: `path to root of my-project`
    * Tools | Add Haskell package dependencies. **This is what enables viewing docs while coding.** It creates a folder ideaHaskellLib in which it runs `stack unpack` for every dependency output by `stack list-dependencies`. **Remember to repeat this step on any change in dependencies.** Add the ideaHaskellLib folder to .gitignore (it's not part of your projects source code).
    * Project Structure | Modules | mark ideaHaskellLib, app and src as Sources, test as Tests.
    * `Tools` | Add Haskell package dependencies. **This is what enables viewing docs while coding.** It creates a folder `ideaHaskellLib` in which it runs `stack unpack` for every dependency output by `stack list-dependencies`. **Remember to repeat this step on any change in dependencies.** Add the `ideaHaskellLib` folder to the `.gitignore` file for the project (it's not part of your projects source code).
    * `Project Structure` | `Modules` | mark `ideaHaskellLib`, `app` and `src` as Sources, `test` as Tests.

    Most or all of the usual features of Intellij like auto-completion, go to declaration `ctrl+b` etc should now work.

  15. androidfred revised this gist May 19, 2016. 1 changed file with 3 additions and 3 deletions.
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ Upon completion you will have a sane, productive Haskell environment adhering to
    ## Download and extract Stack
    Don't install Haskell, Stack, Cabal or any other Haskell tool or library using your OS package manager or using Cabal.

    Instead, download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)
    Instead, download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to `$PATH`. (adding a folder to `$PATH` is beyond the scope of this tutorial, search and you will find)

    ## Use Stack to create, build and run a project
    Go to the folder where you want to create your Haskell project and run
    @@ -31,8 +31,8 @@ to install tools required by the IDE plugin for Haskell. (they will be installed
    * Download and Intellij IDEA IDE from http://www.jetbrains.com/idea and extract it to some appropriate folder.
    * Start IntelliJ up and install the plugin `Intellij-Haskell`. (NOTE there are a number of different mutually exclusive Haskell plugins- they can't be installed simultaneously. If other Haskell plugins are already installed, uninstall them before installing the `Intellij-Haskell` plugin)
    * Restart IntelliJ.
    * Settings | Other | Haskell | add the respective paths to the tools (eg for ghc-mod `~/.local/bin/ghc-mod`)
    * File | New | Project | select Haskell module and tick the Haskell box | Next | create GHC SDK using path to GHC binaries `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin` | Project name: my-project, Project location: `path to root of my-project`
    * `Settings` | `Other` | `Haskell` | add the respective paths to the tools (eg for ghc-mod `~/.local/bin/ghc-mod`)
    * `File` | `New` | `Project` | select `Haskell module` and tick the Haskell box | `Next` | create GHC SDK using path to GHC binaries `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin` | `Project name`: `my-project`, `Project location`: `path to root of my-project`
    * Tools | Add Haskell package dependencies. **This is what enables viewing docs while coding.** It creates a folder ideaHaskellLib in which it runs `stack unpack` for every dependency output by `stack list-dependencies`. **Remember to repeat this step on any change in dependencies.** Add the ideaHaskellLib folder to .gitignore (it's not part of your projects source code).
    * Project Structure | Modules | mark ideaHaskellLib, app and src as Sources, test as Tests.

  16. androidfred revised this gist May 19, 2016. 1 changed file with 3 additions and 4 deletions.
    Original file line number Diff line number Diff line change
    @@ -33,11 +33,10 @@ to install tools required by the IDE plugin for Haskell. (they will be installed
    * Restart IntelliJ.
    * Settings | Other | Haskell | add the respective paths to the tools (eg for ghc-mod `~/.local/bin/ghc-mod`)
    * File | New | Project | select Haskell module and tick the Haskell box | Next | create GHC SDK using path to GHC binaries `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin` | Project name: my-project, Project location: `path to root of my-project`
    * Project Structure | Modules | mark app and src as Sources, test as Tests
    * Tools | Add Haskell package dependencies (**this is what enables viewing docs while coding**)
    * Project Structure | Modules | mark ideaHaskellLib as Sources
    * Tools | Add Haskell package dependencies. **This is what enables viewing docs while coding.** It creates a folder ideaHaskellLib in which it runs `stack unpack` for every dependency output by `stack list-dependencies`. **Remember to repeat this step on any change in dependencies.** Add the ideaHaskellLib folder to .gitignore (it's not part of your projects source code).
    * Project Structure | Modules | mark ideaHaskellLib, app and src as Sources, test as Tests.

    Auto-completion, Open "class" `ctrl+n`, Go to declaration `ctrl+b` etc should now work. Try eg placing the caret on the line putStrlLine and pressing `ctrl+b`.
    Most or all of the usual features of Intellij like auto-completion, go to declaration `ctrl+b` etc should now work.

    ## MISC
    ### Development flow
  17. androidfred revised this gist May 17, 2016. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -57,7 +57,7 @@ Stack can install and manage multiple Haskell versions, and different versions o
    ```bash
    stack update
    ```
    This is why neither Haskell nor Stack or any of the libraries should be installed and managed through the OS package manager or Cabal. (anything installed and managed through the OS package manager will be a single, global version, and the versions are often lagging severely)
    This is why neither Haskell, Stack, Cabal nor any other Haskell tool or library should be installed and managed through the OS package manager or Cabal. (anything installed and managed through the OS package manager will be a single, global version, and the versions are often lagging severely)

    ### Other IntelliJ plugins for Haskell
    As previously seen, there are other IntelliJ plugins for Haskell that may or may not be better than, have more features etc than the `Intellij-Haskell` plugin, but I've been unable to get any of them running. Which brings us to...
  18. androidfred revised this gist May 17, 2016. 1 changed file with 3 additions and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,9 @@ Upon completion you will have a sane, productive Haskell environment adhering to
    * Intellij IDEA IDE is a popular IDE.

    ## Download and extract Stack
    Don't install Haskell, Stack, Cabal or any other Haskell tool or library using your OS package manager or using Cabal. Instead, download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)
    Don't install Haskell, Stack, Cabal or any other Haskell tool or library using your OS package manager or using Cabal.

    Instead, download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)

    ## Use Stack to create, build and run a project
    Go to the folder where you want to create your Haskell project and run
  19. androidfred revised this gist May 17, 2016. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ Upon completion you will have a sane, productive Haskell environment adhering to
    * Intellij IDEA IDE is a popular IDE.

    ## Download and extract Stack
    Download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)
    Don't install Haskell, Stack, Cabal or any other Haskell tool or library using your OS package manager or using Cabal. Instead, download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)

    ## Use Stack to create, build and run a project
    Go to the folder where you want to create your Haskell project and run
  20. androidfred revised this gist May 17, 2016. 1 changed file with 0 additions and 3 deletions.
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,6 @@ Upon completion you will have a sane, productive Haskell environment adhering to
    * Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
    * Intellij IDEA IDE is a popular IDE.

    ## Clean slate
    If Haskell, Stack, Cabal or any other Haskell library or tool is already installed on your system, I suggest you purge them entirely from your system before proceeding.

    ## Download and extract Stack
    Download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)

  21. androidfred revised this gist May 17, 2016. 1 changed file with 2 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@ to install tools required by the IDE plugin for Haskell. (they will be installed
    * Tools | Add Haskell package dependencies (**this is what enables viewing docs while coding**)
    * Project Structure | Modules | mark ideaHaskellLib as Sources

    Auto-completion, Open "class" `ctrl+n`, Go to declaration `ctrl+b` etc should now work. Try eg placing the caret on the line putStrlLine and pressing `ctrl+b` to try it out.
    Auto-completion, Open "class" `ctrl+n`, Go to declaration `ctrl+b` etc should now work. Try eg placing the caret on the line putStrlLine and pressing `ctrl+b`.

    ## MISC
    ### Development flow
    @@ -51,7 +51,7 @@ to fire up the interpreter, then
    :load Main
    main
    ```
    to interactively load the Main module and call the main function. New functions can also be defined and tried out interactively. It's a faster development flow than writing the source code in the source code files and building running the project all the time.
    to interactively load the Main module and call the main function. New functions can also be defined and tried out interactively. It's a faster development flow than writing the source code in the source code files and building and running the project all the time.

    ### Updating Haskell and Stack
    Stack can install and manage multiple Haskell versions, and different versions of different libraries in different projects. Stack itself can be updated simply by running
  22. androidfred revised this gist May 17, 2016. 1 changed file with 2 additions and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,10 @@ Upon completion you will have a sane, productive Haskell environment adhering to
    * Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
    * Intellij IDEA IDE is a popular IDE.

    ## Download and extract Stack
    ## Clean slate
    If Haskell, Stack, Cabal or any other Haskell library or tool is already installed on your system, I suggest you purge them entirely from your system before proceeding.

    ## Download and extract Stack
    Download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)

    ## Use Stack to create, build and run a project
  23. androidfred revised this gist May 17, 2016. 1 changed file with 2 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -7,9 +7,9 @@ Upon completion you will have a sane, productive Haskell environment adhering to
    * Intellij IDEA IDE is a popular IDE.

    ## Download and extract Stack
    Don't install Haskell, Stack or Cabal using your OS package manager or using Cabal. (if Haskell, Stack or Cabal are already installed through your OS package manager or through Cabal, I suggest you purge them entirely from your system before proceeding)
    If Haskell, Stack, Cabal or any other Haskell library or tool is already installed on your system, I suggest you purge them entirely from your system before proceeding.

    Instead, download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)
    Download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)

    ## Use Stack to create, build and run a project
    Go to the folder where you want to create your Haskell project and run
  24. androidfred revised this gist May 17, 2016. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -57,7 +57,7 @@ Stack can install and manage multiple Haskell versions, and different versions o
    ```bash
    stack update
    ```
    This is why neither Haskell nor Stack or any of the libraries should be installed and managed through the OS package manager. (anything installed and managed through the OS package manager will be a single, global version, and the version are often lagging severely)
    This is why neither Haskell nor Stack or any of the libraries should be installed and managed through the OS package manager or Cabal. (anything installed and managed through the OS package manager will be a single, global version, and the versions are often lagging severely)

    ### Other IntelliJ plugins for Haskell
    As previously seen, there are other IntelliJ plugins for Haskell that may or may not be better than, have more features etc than the `Intellij-Haskell` plugin, but I've been unable to get any of them running. Which brings us to...
  25. androidfred revised this gist May 17, 2016. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ Upon completion you will have a sane, productive Haskell environment adhering to
    * Intellij IDEA IDE is a popular IDE.

    ## Download and extract Stack
    Don't install Haskell or Stack using your OS package manager. (if Haskell or Stack are already installed through your OS package manager, I suggest you purge them from your OS entirely before proceeding)
    Don't install Haskell, Stack or Cabal using your OS package manager or using Cabal. (if Haskell, Stack or Cabal are already installed through your OS package manager or through Cabal, I suggest you purge them entirely from your system before proceeding)

    Instead, download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)

  26. androidfred revised this gist May 17, 2016. 1 changed file with 9 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -2,12 +2,12 @@
    Upon completion you will have a sane, productive Haskell environment adhering to best practices.

    ## Basics
    * Haskell is a programming language.
    * Haskell is a programming language.
    * Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
    * Intellij IDEA IDE is a popular IDE.

    ## Download and extract Stack
    Don't install Haskell or Stack using your OS package manager. (if Haskell or Stack are already installed through your package manager, I suggest you purge them from your system entirely before proceeding)
    Don't install Haskell or Stack using your OS package manager. (if Haskell or Stack are already installed through your OS package manager, I suggest you purge them from your OS entirely before proceeding)

    Instead, download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)

    @@ -52,6 +52,13 @@ main
    ```
    to interactively load the Main module and call the main function. New functions can also be defined and tried out interactively. It's a faster development flow than writing the source code in the source code files and building running the project all the time.

    ### Updating Haskell and Stack
    Stack can install and manage multiple Haskell versions, and different versions of different libraries in different projects. Stack itself can be updated simply by running
    ```bash
    stack update
    ```
    This is why neither Haskell nor Stack or any of the libraries should be installed and managed through the OS package manager. (anything installed and managed through the OS package manager will be a single, global version, and the version are often lagging severely)

    ### Other IntelliJ plugins for Haskell
    As previously seen, there are other IntelliJ plugins for Haskell that may or may not be better than, have more features etc than the `Intellij-Haskell` plugin, but I've been unable to get any of them running. Which brings us to...

  27. androidfred revised this gist May 17, 2016. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    Upon completion you will have a sane, productive Haskell environment adhering to best practices.

    ## Basics
    * Haskell is the programming language you want to learn.
    * Haskell is a programming language.
    * Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
    * Intellij IDEA IDE is a popular IDE.

  28. androidfred revised this gist May 17, 2016. 1 changed file with 5 additions and 3 deletions.
    Original file line number Diff line number Diff line change
    @@ -3,11 +3,13 @@ Upon completion you will have a sane, productive Haskell environment adhering to

    ## Basics
    * Haskell is the programming language you want to learn.
    * Stack is tool for developing Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
    * Stack is tool for Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
    * Intellij IDEA IDE is a popular IDE.

    ## Download and extract Stack
    Don't install Haskell or Stack using your OS package manager. Instead, download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)
    Don't install Haskell or Stack using your OS package manager. (if Haskell or Stack are already installed through your package manager, I suggest you purge them from your system entirely before proceeding)

    Instead, download Stack from http://docs.haskellstack.org/en/stable/install_and_upgrade/#linux and extract it into `~/.local/bin` (ie the complete path to stack should be `~/.local/bin/stack`) and add `~/.local/bin` to PATH. (adding a folder to PATH is beyond the scope of this tutorial, search and you will find)

    ## Use Stack to create, build and run a project
    Go to the folder where you want to create your Haskell project and run
    @@ -53,5 +55,5 @@ to interactively load the Main module and call the main function. New functions
    ### Other IntelliJ plugins for Haskell
    As previously seen, there are other IntelliJ plugins for Haskell that may or may not be better than, have more features etc than the `Intellij-Haskell` plugin, but I've been unable to get any of them running. Which brings us to...

    ### Frustrations
    ### What went in to this Gist
    I tried several times to pick up Haskell, but always gave up, not due to anything to do with the language itself, but due to not being able to set up a sane, productive environment. After lots of time, energy and frustration it appears as if I've finally figured out how to do it. This Gist is for my own future reference, but I hope others will find it useful as well, and that others won't have to go through what I went through just in order to get started.
  29. androidfred revised this gist May 17, 2016. 1 changed file with 22 additions and 2 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    #Haskell, Stack and Intellij IDEA IDE setup tutorial how to get started
    Upon completion you will have a sane, productive Haskell environment adhering to best practices.

    ## Basics
    * Haskell is the programming language you want to learn.
    * Stack is tool for developing Haskell projects. (similar tools for other languages include Maven, Gradle, npm, RubyGems etc)
    * Intellij IDEA IDE is a popular IDE.
    @@ -26,12 +27,31 @@ stack install hlint stylish-haskell ghc-mod
    ```
    to install tools required by the IDE plugin for Haskell. (they will be installed to `~/.local/bin`)
    * Download and Intellij IDEA IDE from http://www.jetbrains.com/idea and extract it to some appropriate folder.
    * Start IntelliJ up and install the plugin `Intellij-Haskell`. (NOTE there are a number of different mutually exclusive Haskell plugins that can't be installed simultaneously. If other Haskell plugins are already installed, uninstall them before installing the `Intellij-Haskell` plugin)
    * Start IntelliJ up and install the plugin `Intellij-Haskell`. (NOTE there are a number of different mutually exclusive Haskell plugins- they can't be installed simultaneously. If other Haskell plugins are already installed, uninstall them before installing the `Intellij-Haskell` plugin)
    * Restart IntelliJ.
    * Settings | Other | Haskell | add the respective paths to the tools (eg for ghc-mod `~/.local/bin/ghc-mod`)
    * File | New | Project | select Haskell module and tick the Haskell box | Next | create GHC SDK using path to GHC binaries `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin` | Project name: my-project, Project location: `path to root of my-project`
    * Project Structure | Modules | mark app and src as Sources, test as Tests
    * Tools | Add Haskell package dependencies (**this is what enables viewing docs while coding**)
    * Project Structure | Modules | mark ideaHaskellLib as Sources

    Auto-completion, Open "class" `ctrl+n`, Go to declaration `ctrl+b` etc should now work. Try eg placing the caret on the line putStrlLine and pressing `ctrl+b` to try it out.
    Auto-completion, Open "class" `ctrl+n`, Go to declaration `ctrl+b` etc should now work. Try eg placing the caret on the line putStrlLine and pressing `ctrl+b` to try it out.

    ## MISC
    ### Development flow
    One of the advantages of Haskell is the interactive interpreter. Go to `path to root of my-project` and run
    ```bash
    stack ghci
    ```
    to fire up the interpreter, then
    ```bash
    :load Main
    main
    ```
    to interactively load the Main module and call the main function. New functions can also be defined and tried out interactively. It's a faster development flow than writing the source code in the source code files and building running the project all the time.

    ### Other IntelliJ plugins for Haskell
    As previously seen, there are other IntelliJ plugins for Haskell that may or may not be better than, have more features etc than the `Intellij-Haskell` plugin, but I've been unable to get any of them running. Which brings us to...

    ### Frustrations
    I tried several times to pick up Haskell, but always gave up, not due to anything to do with the language itself, but due to not being able to set up a sane, productive environment. After lots of time, energy and frustration it appears as if I've finally figured out how to do it. This Gist is for my own future reference, but I hope others will find it useful as well, and that others won't have to go through what I went through just in order to get started.
  30. androidfred revised this gist May 17, 2016. 1 changed file with 1 addition and 4 deletions.
    Original file line number Diff line number Diff line change
    @@ -29,10 +29,7 @@ to install tools required by the IDE plugin for Haskell. (they will be installed
    * Start IntelliJ up and install the plugin `Intellij-Haskell`. (NOTE there are a number of different mutually exclusive Haskell plugins that can't be installed simultaneously. If other Haskell plugins are already installed, uninstall them before installing the `Intellij-Haskell` plugin)
    * Restart IntelliJ.
    * Settings | Other | Haskell | add the respective paths to the tools (eg for ghc-mod `~/.local/bin/ghc-mod`)
    * Open | `path to root of my-project`
    * Project Structure | SDKs | + | GHC binaries | `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin`
    * Project Structure | Project | Project SDK | select the newly created SDK
    * Project Structure | Modules | remove whatever module is there (it won't delete the files from disk) | add a new Haskell module | tick the Haskell box | Next | select the newly created SDK | Next | Module name: my-project, Content root: `path to root of my-project` (remove any duplicate trailing my-project), Module file location: `path to root of my-project` (remove any duplicate trailing my-project)
    * File | New | Project | select Haskell module and tick the Haskell box | Next | create GHC SDK using path to GHC binaries `~/.stack/programs/x86_64-linux/ghc-7.10.3/bin` | Project name: my-project, Project location: `path to root of my-project`
    * Project Structure | Modules | mark app and src as Sources, test as Tests
    * Tools | Add Haskell package dependencies (**this is what enables viewing docs while coding**)
    * Project Structure | Modules | mark ideaHaskellLib as Sources