#!/usr/bin/runghc main = putStrLn "Hello World!"This is really just one line of Haskell, if you ignore the "shebang" line that tells the system to use "runghc" to cope with the file. On my system, this is the file "hello.hs" and I run it via:
./hello.hsWhen you tell haskell to run a program, it looks for a function called "main" and tries to evaluate it. If there is no main, it gets upset.
There is more going on here than meets the eye. Rather than explain things now, we will refer back to this when we get to the concepts themselves.
Many tutorials side-step this and have you run "ghci" which is an interactive Haskell tool. I have never been entirely happy with this because there are some special rules that make some things different when used from the ghci prompt. If you go that route, you will have to unlearn certain things later.
Not only that, but if I want to work with more than a line or two of haskell, I want to use a text editor to put it into a file. Suit yourself
ghc hello1.hs ./hello1
I don't talk about how to install Haskell. You will have to do some searching and learn how to install it on your system. I use Haskell on my Fedora linux system (currently running Fedora 44). I found "ghc" in the standard Fedora package collection and installed it using the standard fedora package manager (dnf). At this point I am using "The Glorious Glasgow Haskell Compilation System, version 9.10.3".
Heaven only knows what you will need to do on your system.
You might start with this link:
This document describes some hair splitting issues with GHC as compared to what is described in the Haskell documents (such that they are). You are unlikely to care about any of this:
Tom's software pages / tom@mmto.org