BarCampPortland 2007 – Intro To Haskell
Session Leader: Bart Massey
Bart Massey
Donnie Berkholz
John Sechrest
tim Bauman
Tim Savard
Jesse Hallett
Haven Hash
Iseff
Maurice Dodik
Jek
Phil Tomson
Sam Keen
What is haskell? And why should I care?
Bart thinks that Haskell is the next big thing.
Why? isn’t C++ enough for anything?
Haskell is a functional programming language.
We build pieces that are so modular, so that mix and match is trivial.
What do you give up?
-Global Variables…
– Variables all together….
What is the difference between a name for a value vs a variable?
Variable is the mapping from a name to a location.
There is no location in haskell
In trade, you get modularity.
GHCI –
interactive , incrementally compiled language
It does static type checking.
no type declarations. The program guesses the type.
Open source community has adopted Haskell.
Haskell programming can be harder , because the lack of variables.
Indentation does matter
No brackets
Not end markers
it is case senstive
it does lazy evaluation
you can do type annotation
emacs count.hs
main = do
printCount 10
where
printCount 1 = putStrLn 1
PrintCount n = do
putStrLn (show n)
printCount ( n – 1 )
gch count.hs
[1,2,3] A list – First class objects
head [1,2,3]
tail [1,2,3]
let count x = x: ( count (x + 1) )
let y = count (1)
head y => 1
take 3 y => [1,2,3]
tail y => infinite list
Is there a way to track what code is run.
there is a profiler
Haskell is 15 years old.
How does haskell performance work
Ocamel ?
C?
As a matter of practice 2-200 Times slower than C.
Language shootout
Darcs is a source code control in haskell
WASH – Web in haskell
web apps in haskell
you get concurrency for free
tile :: Int -> Int -> [a] -> [[a]]
Currying
Tile _ _ [] = []
tile n o s =
let cur = take n s
rest = drop ( n – o ) s in
cur : ( tile n o rest)
peak s = ( maximum . map abs . map avg . tile 3 2 ) s
. means composition
Guarded patterns
Lambda calculus
Y combinator -> The function that expresses recursion as a foundation.
If you know ML , it does help.
A program you want to write quickly
pretty sure it is right the first time
get reasonable performance
Access to an active programming community
Resources
———–
http://www.haskell.org
http://www.haskell.org/tutorial
svcs.cs.pdx.edu/git/ppg.git
truelevel.git
http://svcs.cs.pdx.edu/darcs/minichess
http://darcs.net/DarcsWiki
Notes By John Sechrest
marketing





