This repository gathers Haskell examples coming from various websites and books. It also includes several build scripts (batch files, Maven scripts) for experimenting with Haskell on a Windows machine. |
Ada, Akka, C++, COBOL, Dafny, Dart, Deno, Docker, Erlang, Flix, Golang, GraalVM, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, Spring, TruffleSqueak, WiX Toolset and Zig are other topics we are continuously monitoring.
This project relies on the following external software for the Microsoft Windows platform:
☛ Haskell packages
We present the installed Haskell packages in documentPACKAGES.md
.
Optionally one may also install the following software:
- Apache Maven 3.9 (requires Java 8+) (release notes)
- ConEmu 2023 (release notes)
- Haskell 9.10 (release notes)
- Stack 2.15 (changelog)
- Temurin OpenJDK 17 (release notes, for Maven)
- Visual Studio Code 1.94 (release notes)
☛ Installation policy
When possible we install software from a Zip archive rather than via a Windows installer. In our case we definedC:\opt\
as the installation directory for optional software tools (in reference to the/opt/
directory on Unix).
For instance our development environment looks as follows (November 2024) 2:
C:\opt\apache-maven\ ( 10 MB) C:\opt\ConEmu\ ( 26 MB) C:\opt\ghc-8.10.7\ (2.5 GB) C:\opt\ghc-9.6.5\ (2.6 GB) C:\opt\ghc-9.10.1\ (5.6 GB) C:\opt\Git\ (358 MB) C:\opt\jdk-temurin-17.0.13_11\ (304 MB) C:\opt\stack\ ( 74 MB) C:\opt\VSCode\ (371 MB)
🔎 Git for Windows provides a BASH emulation used to run
git
from the command line (as well as over 250 Unix commands likeawk
,diff
,file
,grep
,more
,mv
,rmdir
,sed
andwc
).
Directory structure ▴
This project is organized as follows:
docs\ examples\{README.md, HelloWorld, ..} parconc-examples\{README.md, ..} PACKAGES.md README.md RESOURCES.md REPL.md setenv.bat
where
- directory
docs\
contains Haskell related papers/articles. - directory
examples\
contains Haskell examples grabbed from various websites (see fileexamples\README.md
). - directory
parconc-examples
contains Haskell examples from Simon Marlow's book (see fileparconc-examples\README.md
). - file
PACKAGES.md
presents the Haskell packages our projects depend on. - file
README.md
is the Markdown document for this page. - file
REPL.md
presents GHCi usage examples. - file
RESOURCES.md
gathers Haskell related informations. - file
setenv.bat
is the batch command for setting up our environment.
We also define a virtual drive – e.g. drive H:
– in our working environment in order to reduce/hide the real path of our project directory (see article "Windows command prompt limitation" from Microsoft Support).
🔎 We use the Windows external command
subst
to create virtual drives; for instance:> subst H: %USERPROFILE%\workspace\haskell-examples
In the next section we give a brief description of the batch files present in this project.
We distinguish different sets of batch commands:
-
setenv.bat
- This batch command makes external tools such ascabal.exe
,git.exe
,sh.exe
andstack.exe
directly available from the command prompt (see section Project dependencies).> setenv help Usage: setenv { <option> | <subcommand> } Options: -debug print commands executed by this script -verbose print progess messages Subcommands: help print this help message
-
examples\*\build.bat
- Each example can be built/run using thebuild
command.> build Usage: build { <option> | <subcommand> } Options: -debug print commands executed by this script -timer print total execution time -verbose print progress messages Subcommands: clean delete generated files compile generate program executable doc generate HTML documentation help print this help message run execute the generated program
Usage examples ▴
We execute command setenv
once to setup our development environment; it makes external tools such as cabal.exe
, git.exe
, sh.exe
and stack.exe
directly available from the command prompt:
> setenv Tool versions: cabal 3.8.1.0, ghc version 8.10.7, stack 2.15.5, haddock 2.24.2 hlint v3.5, hpack 0.35.1, htfpp 0.14.0.6, ormolu 0.7.0.0 java 17.0.13, mvn 3.9.9, git 2.47.0, diff 3.10 > where cabal git hlint hpack sh stack C:\opt\ghc-8.10.7\bin\cabal.exe C:\opt\Git\bin\git.exe C:\opt\Git\mingw64\bin\git.exe %APPDATA%\Cabal\bin\hlint.exe %APPDATA%\Cabal\bin\hpack.exe C:\opt\Git\bin\sh.exe C:\opt\Git\usr\bin\sh.exe C:\opt\stack\stack.exe
Command setenv -verbose
also displays the tool paths and defined variables:
> setenv -verbose Tool versions: cabal 3.8.1.0, ghc version 8.10.7, stack 2.15.5, haddock 2.24.2 hlint v3.5, hpack 0.35.1, htfpp 0.14.0.6, ormolu 0.7.0.0 java 17.0.13, mvn 3.9.9, git 2.47.0, diff 3.10 Tool paths: %APPDATA%\cabal\bin\cabal.exe C:\opt\ghc-8.10.7\bin\ghc.exe C:\opt\stack\stack.exe C:\opt\ghc-8.10.7\bin\haddock.exe %APPDATA%\Cabal\bin\hlint.exe %APPDATA%\Cabal\bin\hpack.exe %APPDATA%\Cabal\bin\htfpp.exe %APPDATA%\Cabal\bin\ormolu.exe C:\opt\jdk-temurin-17.0.13_11\bin\java.exe C:\opt\apache-maven\bin\mvn.cmd C:\opt\Git\bin\git.exe C:\opt\Git\mingw64\bin\git.exe C:\opt\Git\usr\bin\diff.exe Environment variables: "CABAL_DIR=%APPDATA%\cabal" "GHC_HOME=C:\opt\ghc-8.10.7" "JAVA_HOME=C:\opt\jdk-temurin-17.0.13_11" "MAVEN_HOME=C:\opt\apache-maven" "STACK_HOME=C:\opt\stack"
Footnotes ▴
[1] Cabal compatibility ↩
[2] Downloads ↩
- In our case we downloaded the following installation files (see section 1):
-
apache-maven-3.9.8-bin.zip ( 10 MB) cabal-install-3.8.1.0-x86_64-unknown-mingw32.zip ( 5 MB) ConEmuPack.230724.7z ( 5 MB) ghc-8.10.7-x86_64-unknown-mingw32.tar.xz (414 MB) ghc-9.10.1-x86_64-unknown-mingw32.tar.xz (471 MB) OpenJDK17U-jdk_x64_windows_hotspot_17.0.13_11.zip ( 99 MB) PortableGit-2.47.0-64-bit.7z.exe ( 41 MB) stack-2.15.5-windows-x86_64.zip ( 15 MB) VSCode-win32-x64-1.92.1.zip (131 MB)
-
a) We observe a big size difference between version 9.2.2 and the others versions listed above.The difference is located in theVersion LLVM Archive Installation Remarks 9.10 . . . . 9.8.1 11-15 Running GHC on Win32 systems 9.6.3 9-12 479 MB 2.78 GB Running GHC on Win32 systems 9.4.4 9-12 479 MB 2.78 GB Running GHC on Win32 systems 9.2.2 a) 10,11 331 MB 1.85 GB Included libraries 9.0.1 9 236 MB 2.64 GB Included libraries 8.10.7 9-12 414 MB 2.80 GB Included libraries lib\x8_64-windows-ghc-9.x.x\
directory, e.g.array-0.5.4.0\
with 1.7 MB versus 4.3 MB due to the absence/presence of the profiling object files (.p_o
extension).