hamacs/ha-programming-haskell.org
Howard Abrams 6d92980311 Migration from ~/other to ~/src
Why was it any other way?
2024-10-19 13:34:01 -07:00

3.2 KiB
Raw Permalink Blame History

Programming Haskell

A literate programming file for configuring Emacs to use Haskell .

Introduction

While “they” claim a Gentle Introduction, it doesnt look fun. I bought the book, Learn You a Haskell for Great Good!, which looks better. Before an Emacsian can dive into a new language, one needs to get an Emacs environment working.

First, get it installed. On a Mac, do something like:

  brew install haskell-stack

Which installs the Haskell Stack project that is basically an interface to the kitchen sink.

And then run:

  stack setup

And then you get access to an interactive session in a virtual environment with:

  stack ghci

Haskell Mode

Seems that the venerable haskell-mode is the best.

  (use-package haskell-mode
    :custom
    (haskell-process-type 'stack-ghci))

See this configuration for some advanced features.

The hindent package looks interesting:

  (use-package hindent
    :custom (hindent-style "johan-tibell")
    :hook (haskell-mode . #'hindent-mode))

Haskell and Org

  (use-package ob-haskell
    :straight (:type built-in)
    :config
    (add-to-list 'org-babel-load-languages '(haskell . t)))

And lets see if this works:

  nums = filter (> 2) [1 .. 5]
  zip nums ['a' .. 'e']
3 a
4 b
5 c