Add gitignore and a multiline function

This commit is contained in:
Arti Zirk 2017-09-12 17:19:58 +03:00
parent 92df99aa2b
commit c4bda1886f
2 changed files with 34 additions and 0 deletions

21
.gitignore vendored Normal file
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
prax1/prax1.hs Normal file → Executable file
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 ++ "!")