Haskell : Create Hello World.

This commit is contained in:
Dmitry Voronin 2024-03-12 21:37:20 +03:00
parent 0488272633
commit 40926bf7e0
4 changed files with 50 additions and 0 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
.NixRoot*
build/

3
haskell/Hello.hs Normal file
View file

@ -0,0 +1,3 @@
main = do
putStrLn "Hello, everybody!"
putStrLn ("Please look at my favorite odd numbers: " ++ show (filter odd [10..20]))

19
haskell/Makefile Normal file
View file

@ -0,0 +1,19 @@
main = "Hello.hs"
build = "build"
elf = "$(build)/elf"
.PHONY: all
all: clean build run
.PHONY: clean
clean:
@rm -rf $(build)
.PHONY: build
build:
@mkdir $(build) &> /dev/null; \
ghc -outputdir $(build) -o $(elf) $(main)
.PHONY: run
run:
@./$(elf)

27
haskell/flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1709961763,
"narHash": "sha256-6H95HGJHhEZtyYA3rIQpvamMKAGoa8Yh2rFV29QnuGw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3030f185ba6a4bf4f18b87f345f104e6a6961f34",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}