commit e3c1d87b19b9e6cb78b0b6e3aa8f87e669f27119
Author: Andrew Laack <andrew.laack@imbue.com>
Date: Sat, 8 Nov 2025 23:52:14 -0600
Very basics of haskell
Diffstat:
5 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,3 @@
+*.o
+*.hi
+*.out
diff --git a/ch1/fib.hs b/ch1/fib.hs
@@ -0,0 +1,10 @@
+module Main where
+
+fib n = if n > 1
+ then fib (n - 1) + fib (n - 2)
+ else
+ if n == 1
+ then 1
+ else 0
+
+main = print (fib 10)
diff --git a/ch1/greeting.hs b/ch1/greeting.hs
@@ -0,0 +1,7 @@
+module Main where
+
+salutation = "Hello"
+person = "Andrew"
+greeting =
+ salutation <> " " <> person
+main = print greeting
diff --git a/ch1/greeting2.hs b/ch1/greeting2.hs
@@ -0,0 +1,6 @@
+module Main where
+
+greet salutation person =
+ salutation <> " " <> person
+
+main = print (greet "Hello" "Andrew")
diff --git a/ch1/hello-world.hs b/ch1/hello-world.hs
@@ -0,0 +1,4 @@
+module Main where
+
+helloWorld = "Hello, World!"
+main = print helloWorld