HaskelL
From N00b to Beginner
About ME
WHY Haskell?

First Contact studying AI back in Uni

Tiling window managers: XMonad(.hs)

Difference of test code for C(GIMP) and Python projects
Main points
XMonad
But
Configuration with HS code
Ignorance
Did not understand the language at all back in University
Type Safety
Good bye Tracebacks because types have changed.
Composition

Perl can be parsed by a Human but it's hard to understand

Haskell Once you Understand the Underlying concepts the language is very concise
Understandability
Back to University
Learn you a Haskell
Quite mathematical and abstract
99 Haskell Problems
It's great to solve them, but ...
cis194  fall14
Homework!
All you need is a push
Take Aways from CIS

Excellent course which focused on practical examples

Got confused with Monads vs Monoids since the lecture first talked about IO
After The course
Applying is more difficult than theory
Happy Hacking: Xmobar
Pitfalls
textToXMLDocument :: LT.Text > Cursor
textToXMLDocument txt = fromDocument doc
where Right doc = parseText def txt
What Not do to
No Alternative!
Compiler Warning? Error?

No Cabal, no Wall

Compiled with Runhaskell to install only my plugin
Plugin works
Coursera  Algorithms II
Easy

Graph (by using Map)

Depth first search
Not so Easy
Breadth first search
  breadth first search

bfs :: Vertex > Graph k a > [Vertex]
bfs x = go [x] (Q.Queue [x][])
where go vs (Q.Queue [] []) _ = vs
go vs q g = go vs' q' g
where (vs', q') = runState (bfsSearchChildren siftChildren vs g) q
  breadth first search helper

bfsSearchChildren :: ([Vertex] > [Vertex] > State (Q.Queue Vertex) [Vertex])
> [Vertex]
> Graph k a
> State (Q.Queue Vertex) [Vertex]
bfsSearchChildren f vs g = state Q.deq >>= \x > case x of
Just y > f (adjToList y g) vs
Nothing > return []
  Returns a new list of visited nodes, while having enqueued all
 unvisited nodes.

siftChildren :: Eq a =>
[a]  children
> [a]  visited nodes
> State (Q.Queue a) [a]  queue in state monad
siftChildren [] vs = return vs
siftChildren xs vs = do
let unvisited = xs L.\\ vs
mapM_ statefulEnq unvisited
return $ vs `L.union` unvisited
where statefulEnq x = void $ state (\q > ((), Q.enq x q))
Future Ideas
Programslice
Static Analysis of (Python) Programs
Take Home Lessons

Theory vs. Applying Information

When you start to tinker you haven't broken the problem down ENOUGH.
Thanks

fraser Tweedale

Images from devopsreactions.tumblr.com, soup.io

Haskell Wiki: https://wiki.haskell.org/State_Monad
Haskell  From Noob to Beginner
By Roman Joost