Add the haskell book
This commit is contained in:
8
Haskell-book/02/.gitignore
vendored
Normal file
8
Haskell-book/02/.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/bower_components/
|
||||
/node_modules/
|
||||
/.pulp-cache/
|
||||
/output/
|
||||
/generated-docs/
|
||||
/.psc*
|
||||
/.purs*
|
||||
/.psa*
|
||||
17
Haskell-book/02/bower.json
Normal file
17
Haskell-book/02/bower.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
||||
28
Haskell-book/02/src/Main.purs
Normal file
28
Haskell-book/02/src/Main.purs
Normal file
@@ -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!"
|
||||
9
Haskell-book/02/test/Main.purs
Normal file
9
Haskell-book/02/test/Main.purs
Normal file
@@ -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."
|
||||
Reference in New Issue
Block a user