Date: July 12, 2020 (2020-07-12)
Until this year, the Haskell Platform shipped with the WinGHCi interpreter, a GUI version of the GHCi command line interpreter. It’s little more than a glorified command line in a new window, but it is used in this Skillshare Haskell class, so I really wanted to install it to follow the guide exactly.
Unfortunately, installing WinGHCi isn’t straightforward. There is no official installer available.
Download Source Code
It is possible to install WinGHCi after installing the Haskell Platform, but you have to download and compile the program.
After downloading, you’ll see an
Install.hs file. This file does not work. It throws error messages when you try to run it with
ghc Install.hs. Ignore this file.
Also, the Installer project does not compile, so you’ll have no luck installing WinGHCi automatically–even if you get WinGHCi to compile.
Install Visual Studio
WinGHCi was created in Microsoft Visual Studio 2008, but it is impossible to download the old version of Visual Studio. Luckily, Visual Studio 2020 automatically upgrades project files from the old version when you open them.
After upgrading them, however, you will run into more problems with compiling. To compile the program, right click on the project in the solution explorer (View > Solution Explorer) and select “Build Solution”.
You encounter a problem: the file
afxres.h is not available,
so Visual Studio idiotically says it’s missing but doesn’t give you any hint as to why it’s missing. I assumed that the file must belong to the project. After searching online and wasting my time gambling on stupid search results, I actually found a helpful answer on the first try, without spending 2+ hours researching–a first!
afxres.h is part of the Microsoft Foundation Class library (MFC), which is not automatically installed with Visual Studio (because of course having things you need automatically installed is too much to ask in 2020).
To install it, find the Visual Studio Installer (search in the Start Menu), click “Modify”, and install “MFC blah blah”.
Now the main .sln solution file will compile. The files it creates are stored in the
I hate software. I really do. Because, unlike other engineering disciplines and real life, software has zero tolerance for errors. If it’s not perfect, it’s simply not good enough. There is no “+/- 1 symbol” tolerance value in your code, so either get it right or hope your head itches, because you’re going to be scratching it a lot.
This is why I admire Dr. Joe Armstrong so much. He understood the importance of having fault-tolerance in a system. Any step made in this direction might be one small step for man, but it will be one giant leap for mankind. Dr. Joe Armstrong’s language, Erlang, was designed with fault tolerance in mind. In no other language is failure a legitimate option, so this is strange and has many implications.
An interesting thought is to generate programs with AIs through informal specifications. Programs are essentially created from path-based decision trees with configurations that resemble the interconnected nature of a game of chess. If an AI can master the game of chess and other engineering disciplines, it should be able to master the process of software engineering and create algorithms based on specifications for the inputs and outputs of a function. If given enough sample data, the AI should internalize the general principle and be able to extrapolate new answers from the data set.
After the program has been compiled, installation is manual. There is no installer, so the Windows registry will not store any details that allow you to uninstall it using the Add/Remove Programs interface in Windows.
To install, you must copy the files to the permanent residence where you think they will make the most sense. If you want to store it with your Haskell installation, you’ll have to do some investigating. Haskell may have been installed in any location, depending on what tool you used to install it–such as Chocolatey, Cygwin, or MinGW.
To find the Haskell installation,
- Open up the command line: Click Start > type “CMD” > Command Prompt.
- Enter the command
- It’ll give you a file path: “C:\ProgramData\chocolatey\lib\ghc\tools\ghc-8.10.1\bin\ghc.exe”
A potential problem is that chocolatey could wipe the folder, since the chocolatey\lib\ folder is managed by Chocolatey, and if the tool gets updated, it could cause it to overwrite your manual installation of WinGHCi. A good idea would be to just keep the WinGHCi folder in a separate location, like your Downloads folder, and create a shortcut to its executable. If the shortcut is in the Downloads folder, it will show up in the Start Menu. If you want it to be a little faster and more organized, copy the shortcut into the Start Menu folder.
To locate the Start Menu folder, click Start, then right click on any app that was not installed via the Microsoft Store, and select More > Open file location.