summaryrefslogtreecommitdiff
path: root/Haskell-book/02
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-12-09 16:32:32 +0100
committerEugen Wissner <belka@caraus.de>2025-12-09 16:32:32 +0100
commit3624c712d72d246f21d4e710cec7c11e052e0326 (patch)
treef385cb51c72a0c5eeb2057609b75f5f8c6c4f272 /Haskell-book/02
parentc95abc31d62e296db4f1b537e3de440dd40defd1 (diff)
downloadbook-exercises-3624c712d72d246f21d4e710cec7c11e052e0326.tar.gz
Add the haskell book
Diffstat (limited to 'Haskell-book/02')
-rw-r--r--Haskell-book/02/.gitignore8
-rw-r--r--Haskell-book/02/bower.json17
-rw-r--r--Haskell-book/02/src/Main.purs28
-rw-r--r--Haskell-book/02/test/Main.purs9
4 files changed, 62 insertions, 0 deletions
diff --git a/Haskell-book/02/.gitignore b/Haskell-book/02/.gitignore
new file mode 100644
index 0000000..9623fa5
--- /dev/null
+++ b/Haskell-book/02/.gitignore
@@ -0,0 +1,8 @@
+/bower_components/
+/node_modules/
+/.pulp-cache/
+/output/
+/generated-docs/
+/.psc*
+/.purs*
+/.psa*
diff --git a/Haskell-book/02/bower.json b/Haskell-book/02/bower.json
new file mode 100644
index 0000000..8771a39
--- /dev/null
+++ b/Haskell-book/02/bower.json
@@ -0,0 +1,17 @@
+{
+ "name": "02",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "output"
+ ],
+ "dependencies": {
+ "purescript-prelude": "^3.1.0",
+ "purescript-console": "^3.0.0",
+ "purescript-math": "^2.1.0"
+ },
+ "devDependencies": {
+ "purescript-psci-support": "^3.0.0"
+ }
+}
diff --git a/Haskell-book/02/src/Main.purs b/Haskell-book/02/src/Main.purs
new file mode 100644
index 0000000..feb0fd2
--- /dev/null
+++ b/Haskell-book/02/src/Main.purs
@@ -0,0 +1,28 @@
+module Main where
+
+import Prelude
+import Control.Monad.Eff (Eff)
+import Control.Monad.Eff.Console (CONSOLE, log)
+import Math (pi)
+
+--
+-- 2.5 Comprehensive check
+--
+mulSquare :: Number -> Number
+mulSquare x = pi * (x * x)
+
+waxOn :: Int
+waxOn = x * 5
+ where x = y * y
+ y = z + 8
+ z = 7
+
+triple :: Int -> Int
+triple x = x * 3
+
+waxOff :: Int -> Int
+waxOff = triple
+
+main :: forall e. Eff (console :: CONSOLE | e) Unit
+main = do
+ log "Hello sailor!"
diff --git a/Haskell-book/02/test/Main.purs b/Haskell-book/02/test/Main.purs
new file mode 100644
index 0000000..845d0f4
--- /dev/null
+++ b/Haskell-book/02/test/Main.purs
@@ -0,0 +1,9 @@
+module Test.Main where
+
+import Prelude
+import Control.Monad.Eff (Eff)
+import Control.Monad.Eff.Console (CONSOLE, log)
+
+main :: forall e. Eff (console :: CONSOLE | e) Unit
+main = do
+ log "You should add some tests."