• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

BarCampPortland - Session - Intro To Haskell

Page history last edited by Nick Jacobsen 16 years, 11 months ago

Haskell

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 via Nick Jacobsen's MoonEdit Server