Browse Source

Add gitignore and a multiline function

master
Arti Zirk 2 years ago
parent
commit
c4bda1886f
2 changed files with 34 additions and 0 deletions
  1. +21
    -0
      .gitignore
  2. +13
    -0
      prax1/prax1.hs

+ 21
- 0
.gitignore View File

@@ -0,0 +1,21 @@
dist
dist-*
cabal-dev
*.o
*.hi
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
.HTF/
.ghc.environment.*

+ 13
- 0
prax1/prax1.hs View File

@@ -1,3 +1,4 @@
#!/usr/bin/env runghc
-- This is a comment

doubleMe x = x * 3
@@ -8,3 +9,15 @@ doubleSmallNumber x = if x <= 100 then doubleMe x else x

-- ' <- uptick is used as convetion to mark lightly modified function
doubleSmallNumber' x = (if x <= 100 then doubleMe x else x) + 1

-- compile: ghc -dynamic prax1.hs
-- flag -dynamic is needed under Arch Linux, can be leaved off on ther envs

-- runghc prax1.hs
-- this also works ↑

-- entrypoint
main = do
putStrLn "Hello World"
name <- getLine
putStrLn ("Hello " ++ name ++ "!")

Loading…
Cancel
Save