The Version 1.4.0 update of Haskell for Mac comes with significantly improved command lines tools (aka HaskellCLI), which may be installed from the app preferences. First of all, by popular request, the command line tools are no longer interfering with other Haskell systems that may already be installed in
Instead, they are now by default installed in the non-conflicting path
is the same version number as that of the HaskellCLI installer). If you do like to use the HaskellCLI tools as the default system-wide Haskell system, you still have got the option to add and remove them from
/usr/local/bin by toggling a checkbox in the “Command Line” app preferences.
Once the command line tools are installed, Haskell for Mac gains a new menu, called “Target”.
The “Target” menu features functionality that applies to a specific executable target as well as the new package manager. Together they obviate the need for the most common explicit uses of command line tools in previous versions of Haskell for Mac. In other words, instead of requiring you to drop down to the command line, Haskell for Mac now calls the command line tools for you.
In particular, the first two menu items support running an entire Haskell executable in a Terminal window, with or without specifying command line arguments that ought to be passed to the Haskell program. To try this, go to the “Welcome Window” (found in the “Window” menu) and open the “SHA1” sample project. Then, select the
SHA1.hs Haskell module and press ⌘R (or select “Target > Run”). This opens a Terminal window executing the
main function in
Following standard Haskell practice, running an executable always invokes the
main function in the
Main module, which is marked with a star in the lower right corner of the file icon in the project navigator.
This functionality is just the start. Forthcoming updates will expose even more command line functionality in the GUI.