top of page
Search
Writer's pictureClarisse Bonang

Haskell and BNFC for Windows Part I

Having trouble with downloading BNFC from a Windows machine? Have no fear, today's blog will provide you with the tools needed to install Git Bash.

Haskell and BNFC on Windows Part I


Haskell development on computers running the Windows operating system is, well, different. Most of the instructions for Haskell and for the Programming Languages course assume you're using a Unix-like operating system such as Linux or the macOS. Many of the commands used won't work on Windows. Fortunately, there's an easy and quick way to make your Windows computer more Unix-like.

Steps to follow:

✅1. The first step involves installing the Git Bash "shell" program. This gives you a shell program that's Unix-like. You'll be able to type commands such as "ls" to list a directory, instead of the similar Windows "dir" command.


✅2. Next, you'll install a second program called mingw, "Minimalist GNU for Windows", which will make your Windows system resemble Unix even more. mingw adds special commands such as mingw32-make that's identical to the Unix make command except for the name.

That name difference presents a problem, as all of the commands in the course use make, not mingw32-make.


✅3. So, for the third step, you'll need to change the name from mingw32-make to make.

(Note that installing the Haskell Glasgow Compiler and related tools has been covered in other course material; this entry assumes you've already done that.)


After making your Windows computer more Unix-like, you can install the Haskell tools including BNFC.exe and Stack, as well as other Haskell tools you'll need.


Install Git Bash

 

What is GitBash?

Git Bash is a command line shell program that provides a Unix-like Bash shell that allows you to type Unix-like commands such as "ls", which lists a directory. (Bash stands for Bourne Again Shell as it's an improvement over the original Bourne Shell, an early Unix shell program developed by Stephen Bourne of Bell Laboratories.) You'll not only get the Git Bash shell but you'll also install the git revision control system too.


To install Git Bash, open a browser to the Git Bash website, https://git-scm.com/ .



Click the Downloads link. The Downloads page will appear. Press the Windows link.



The Downloading Git page will appear.

Most likely a download dialog window will appear, similar to the following, asking you to save the installation file.



Click on the Save File button and save the installation program in a convenient location.


After saving the file, open Windows Explorer to the location where you save it.



Double click on the installation file.


Windows will prompt you if it is OK to install this on your computer. Answer yes.


The Git Setup window will appear.


The concise instructions below should get you through the installation; however, for

detailed instructions, please see the following external site: https://www.stanleyulili.com/git/how-to-install-git-bash-on-windows/



Follow the displayed instructions from this point on. You can generally choose the default settings.


You'll be asked to choose the installation location, and then to choose components. Next, it will prompt you to choose the Start Menu Folder. In all cases, the default values are fine.


Next it will prompt you to choose the default editor.


Vim is found on every Unix-like system, even on macOS systems. It's difficult to use, but worth learning. There are other options as well available from a drop-down list. Many prefer the Nano editor.




After choosing your editor and pressing the Next button, you'll be asked to Adjust your path environment. This requires you to decide how to use the git version control system.


The safest choice is to use "Git from Git Bash only".


Next, choose the HTTPS Transport Backend.


The recommended choice is to select the "Use the OpenSSL library" option. Press the Next button.


You'll next be asked to "Configure the Line Ending Conventions."


Choose the "Checkout Windows-style, commit Unix-style line endings" option and press the Next button.


The next window display is called "Configuring the terminal emulator to use with Git Bash".


Choose the "Use MinTTY (the default terminal of MSYS2)" option. Press the Next button.


The last decisions you need to make are presented in several dialogs called "Configuring Extra Options."



On the first page of "Configuring Extra Options", select the "Enable File System Caching" and "Enable Git Credential Manager"; leave the other option unselected and press the Next button.


On the second page of "Configuring Extra Options", leave the "experimental" options unselected. Press the Install button.


The installation will now proceed.


When the "Completing the Git Setup Wizard" dialog appears, ensure that the "Launch Git Bash" option is checked and then press the Finish button.


The Git Bash shell will now appear. It will look something like the following.


Try typing a Unix-like command like ls, then press enter. The contents of the current directory should be listed.


You've now installed the Git Bash command line shell (and, incidentally, the git revision control system).


Let's check that the Glasgow Haskell Compiler may be executed from the Git Bash command line shell.


At the command prompt, type: which ghc


ghc is the name of the Glasgow Haskell Compiler program. The which command searches for its location in your PATH.




The which command should return the location where the ghc executable program was installed; the location on my system is shown above.


The Haskell interpreter is available at the Git Bash command line too; though it has some idiosyncrasies:



You can now run Haskell programs within the Git Bash shell much as you could on a Unix-like computer.


Next, you'll need to install a Unix-like make command on your Windows system.

In next week's blog, we'll continue with setting up your Haskell and BNFC development environment.



Next Week's Blog

Haskell and BNFC for Windows Part II


 

References




35 views0 comments

Recent Posts

See All

Comments


Post: Blog2_Post
bottom of page