This commit is contained in:
Amy de Buitléir 2025-09-14 20:49:57 +01:00
parent a23029eb15
commit 00bfdf2c0f
12 changed files with 161 additions and 140 deletions

View file

@ -70,7 +70,7 @@ Let's enter a shell with the Glasgow Haskell Compiler ("ghc") and try to run the
....
$# echo '$ nix shell nixpkgs#ghc'
$# nix shell nixpkgs#ghc --command sh
$ runghc Main.hs
$ runghc Main.hs # Won't work
....
The error message tells us that we need the module `Network.HostName`.
@ -81,7 +81,7 @@ Let's exit that shell and try again, this time adding the `hostname` package.
$# echo '$ exit'
$# echo '$ nix shell nixpkgs#ghc nixpkgs#hostname'
$# nix shell nixpkgs#ghc nixpkgs#hostname --command sh
$ runghc Main.hs
$ runghc Main.hs # Won't work
....
That reason that failed is that we asked for the wrong package.
@ -95,7 +95,7 @@ Let's try that again, with the correct package.
$# echo '$ exit'
$# echo '$ nix shell nixpkgs#ghc nixpkgs#haskellPackages.hostname'
$# nix shell nixpkgs#ghc nixpkgs#haskellPackages.hostname --command sh
$ runghc Main.hs
$ runghc Main.hs # Won't work
....
Now what's wrong?
@ -121,10 +121,6 @@ $ runghc Main.hs
Success! Now we know the program works.
....
$# echo '$ exit'
....
== The cabal file
It's time to write a Cabal file for this program.