You (probably) already have your favorite text editor installed – so we won’t waste time, on that! ⚡ ⏳
For the purposes of this tutorial – we’ll be using the “G.H.C.” (the most widely used “Haskell” compiler). The best way to get started – is to download the “Haskell” Platform (which – is (basically) “Haskell” «with batteries included»). 🔋🔋🔋
“G.H.C.” – can take a “Haskell” script (they (usually) have an “.hs”-extension) – and compile it 📜; but it (also) has an interactive mode – which allows you to “interactively interact” with scripts, interactively … 📝
You can call functions (from scripts, which you load) – and – the results are displayed immediately! ⚡ … For learning 🎓 – it’s a lot easier (and faster), than recompiling every time, when you make a change (and then – “running” the program, from the prompt).
The “interactive mode” – can be invoked by typing in «ghci
», at your prompt. ⌨
If you have defined some functions (in a “file” called (say) «myfunctions.hs
» 🗄):
:l myfunctions
» … Then – you can “play” with them (provided – the «myfunctions.hs
» is in the same folder 📂, from which the «ghci
» was invoked).:l myfunctions
» again (or – do a «:r
», – which is equivalent, because it reloads the current script 🔁).The usual workflow (for “me”, when playing around in stuff) – is:
This – is (also) what we’ll be doing, here.