1.4 script files
When we want to reference custom definitions, we need to make a header file, which Haskell calls a script file and utilizes the *.lhs
extension for literate haskell script. More on this can be found at the haskell wiki literate programming page. Ultimately:
"The main idea is to regard a program as a communication to human beings rather than as a set of instructions to a computer."
Knuth
(I've seen his house, it's kind of boxy)
In fact, this is so customized to 'human beings' that to make clear which sections are code/actual definitions and not comments, you utilize either carets >
(affectionately called bird tracks), which you have to add a newline between a program line and a comment:
comments go here
> defns
and can go here
Or,, you can do the 'human' way:
comments
\begin{code}
defns
\end{code}
comments
Yeah, you can really tell who this language was made for and who made it.
The textbook calls this commenting format to be
a Good Thing by all Right Thinking People.
If you want to maintain consistency with extensions, you can declare definitions within *.hs
files because all lines are definition lines. See conventions for how to instead put comments with dashes and curly braces.