This is the BBC's Haskell Workshop group.
Download the Haskell Platform or stack
- Syntastic supports Haskell syntax checking
- Minimal syntax highlighting
- Vim-one supports lightweight syntax highlighting for Vim
- Ale Asynchronous Lint Engine. Works with numerous languages, but doesnt play nicely with other syntax checkers (e.g. Syntastic or neomake). Ale provides real time linting and syntax checking and can also provide autocompletion.
Enter :set prompt "ghci> " in $HOME/.ghci for a more descriptive and permanent prompt.
In your terminal you can open the interpreter with ghci
or stack ghci
.
To compile a program, run ghc Filename.hs
or stack ghc Filename.hs
. This
will create an executable in the current directory which you can run.
Learn You a Haskell for Great Good!
It is recommended a chapter a week is read and exercises completed.
The exercises for the book are in the learnYouAHaskellExercises/src
directory.
Each file corresponds to a chapter of LYAH.
- C2StartingOut.hs
- C3TypesAndTypeclasses.hs
- C4SyntaxInFunctions.hs
- C5Recursion.hs
- C6HOF.hs
If you wish to do the exercises, create a folder within the root of this repo,
e.g <name>/exercises
and copy the contents of
learnYouAHaskellExercises
into your weeks folder.
Once you have loaded ghci
, you can load each module/file into the
interpreter,
$ cd <name>/exercises
$ stack ghci
Prelude> :l Filename.hs
-- Now you can run the functions in that module here
The exercises come in various degrees of difficulty, hopefully starting straightforward and then ramping up somewhat. If you try to run a exercises that you have not implemented yet, it will throw an error in the interpreter letting you know.
You can also run unit tests to check whether your implementation is correct. In the learnYouAHaskellExercises directory, run:
$ cd <name>/exercises
$ stack test
to run the tests.
Feel free to contribute if they are too easy, too hard, or you have any suggestions.