diff --git a/3-99 Research/Haskell/Chapter 1 - Introduction.md b/3-99 Research/Haskell/Chapter 1 - Introduction.md index 115a21b5..6da35e88 100644 --- a/3-99 Research/Haskell/Chapter 1 - Introduction.md +++ b/3-99 Research/Haskell/Chapter 1 - Introduction.md @@ -20,5 +20,7 @@ A Haskell compiler! The recommended one is GHC. GHC can compile code but it can also run from the prompt interactively, by running 'ghci'. You can list functions from the current folder using ':l filename'. The file can be reloaded using ':r' +I got Haskell installed and set up the Haskell Language Server for Neovim. That took a little bit more effort than anticipated but eventually I got it to work. My Lua files are so fucked. ChatGPT helped a lot though. + [^1]: not really Rust, because I believe Rust has functional programming support. diff --git a/3-99 Research/Haskell/main.hs b/3-99 Research/Haskell/main.hs index e69de29b..36a645c3 100644 --- a/3-99 Research/Haskell/main.hs +++ b/3-99 Research/Haskell/main.hs @@ -0,0 +1,12 @@ +module Main where + +-- A simple function that calculates the sum of a list of numbers. +sumList :: [Int] -> Int +sumList xs = foldl (+) 0 xs + +main :: IO () +main = do + let numbers = [1, 2, 3, 4, 5] + -- Intentional error: 'numers' is misspelled to test error detection. + print (sumList numbers) +