Programming in Haskell
Haskell is a general-purpose, purely functional language. And although it is not intended to develop a banking Core in it, it can serve as a means of mental training, or a mere initiative to expand knowledge. For others it may be valid exclusively for passing a certain university subject.
The most interesting features of Haskell include support for recursive data types and functions, lists, tuples, guards, and pattern matching. The combination of them can result in some almost trivial functions whose version in imperative languages can be extremely tedious to program.
Working with Haskell must always be done thinking about a good editor, since the number of parentheses that we can implement in certain operations can be difficult to manage mentally. Therefore, it is better to look for an Ultraedit, Notepad++ on Windows, or an eMacs, Vim or mc on GNU/Linux.
The compiler to use is hugs, in several versions, of which we are going to highlight:
And to make everything more user-friendly (within what Haskell allows) to configure the editor we will do it with:
:set +E__
Like for example:
:set +Emcedit
:set +Eemacs
:set +Evim
For more commands related to the compiler:
:load load modules from specified files
:load clear all files except prelude
:also read additional modules
:reload repeat last load command
:edit edit file
:edit edit last module
:module set module for evaluating expressions
evaluate expression
:type print type of expression
:? display this list of commands
:set set command line options
:set help on command line options
:names [pat] list names currently in scope
:info describe named objects
:browse browse names exported by
:main run the main function with the given arguments
:find edit module containing definition of name
:cd dir change directory
:gc force garbage collection
:version print Hugs version
:quit exit Hugs interpreter