Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

final touches

  • Loading branch information...
commit 9a1da4ff90cb5cd294a0f9c6db8164cdf2dbcd18 1 parent fe5ef0b
@mzero authored
Showing with 128 additions and 17 deletions.
  1. +1 −1  Makefile
  2. +3 −3 Part1.hs
  3. +58 −10 slides.html
  4. +66 −3 slides.md
View
2  Makefile
@@ -1,7 +1,7 @@
all: slides.html
slides.html: slides.md
- pandoc --offline -s -t slidy -i -o $@ $<
+ pandoc --offline -s -t slidy -o $@ $<
clean:
-rm -f slides.html
View
6 Part1.hs
@@ -46,9 +46,9 @@ process' t = (unlines . sort . lines) t
process'' = unlines . sort . lines
-poem = "breakfast apple pie\n\
- \lunch banana yoghurt for\n\
- \dinner cantaloupe\n"
+poem = "occasional clouds\n\
+ \one gets a rest\n\
+ \from moon-viewing\n"
-- show the poem in ghci with:
-- > putStr $ poem
View
68 slides.html
@@ -7,7 +7,7 @@
<meta name="generator" content="pandoc" />
<meta name="author" content="Mark Lentczner" />
<meta name="date" content="2011-09-29" />
- <title>Haskell Bits</title>
+ <title>Haskell Amuse Bouche</title>
<style type="text/css">
/*<![CDATA[*/
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode, table.sourceCode pre
@@ -442,7 +442,7 @@
</head>
<body>
<div class="slide titlepage">
- <h1 class="title">Haskell Bits</h1>
+ <h1 class="title">Haskell Amuse Bouche</h1>
<p class="author">
Mark Lentczner
</p>
@@ -450,7 +450,7 @@ <h1 class="title">Haskell Bits</h1>
</div>
<div class="slide">
<h1 id="haskell-is-scary">Haskell is Scary</h1>
-<ul class="incremental">
+<ul>
<li>Oh noes! Where's my state?</li>
<li>Hey, I don't want my program to be lazy!</li>
<li>Yo, PHP doesn't need no templates or combinators...</li>
@@ -460,7 +460,7 @@ <h1 id="haskell-is-scary">Haskell is Scary</h1>
</div>
<div class="slide">
<h1 id="haskell-is-scary-cool">Haskell is Scary Cool</h1>
-<ul class="incremental">
+<ul>
<li>Functional</li>
<li>Lazy</li>
<li>Higher order Functions</li>
@@ -470,7 +470,7 @@ <h1 id="haskell-is-scary-cool">Haskell is Scary Cool</h1>
</div>
<div class="slide">
<h1 id="why-i-got-hooked">Why I got hooked</h1>
-<ul class="incremental">
+<ul>
<li>It is a new way to thinking about programming</li>
<li>It twists the brain in delightful ways.</li>
<li>It is very expressive, yet concise and clear</li>
@@ -479,13 +479,18 @@ <h1 id="why-i-got-hooked">Why I got hooked</h1>
</div>
<div class="slide">
<h1 id="warning">Warning</h1>
-<ul class="incremental">
+<ul>
<li><p>I have a lot of code to show you</p></li>
<li><p>It's gonna look like crazy-moon language</p></li>
<li><p>Be brave</p></li>
</ul>
</div>
<div class="slide">
+<h1 id="wanna-play-along">Wanna play along?</h1>
+<p>The slides and code are here:</p>
+<p><code>https://github.com/mtnviewmark/haskell-amuse-bouche</code></p>
+</div>
+<div class="slide">
<h1 id="something-familiar">Something Familiar</h1>
<pre class="sourceCode"><code class="sourceCode bash"><span class="kw">cat</span> poem <span class="kw">|</span> <span class="kw">sort</span></code></pre>
<pre class="sourceCode"><code class="sourceCode bash"><span class="kw">cat</span> poem <span class="kw">|</span> <span class="kw">rev</span> <span class="kw">|</span> <span class="kw">head</span></code></pre>
@@ -493,7 +498,7 @@ <h1 id="something-familiar">Something Familiar</h1>
</div>
<div class="slide">
<h1 id="what-do-they-all-do">What do they all do?</h1>
-<ul class="incremental">
+<ul>
<li><p>Take input</p></li>
<li><p>Process the input.</p></li>
<li><p>Produce output as soon as they're able.</p></li>
@@ -504,11 +509,23 @@ <h1 id="what-do-they-all-do">What do they all do?</h1>
<div class="slide">
<h1 id="lets-write-that-in-haskell">Let's write that in Haskell</h1>
<pre class="sourceCode"><code class="sourceCode haskell">main <span class="fu">=</span> <span class="fu">readFile</span> <span class="st">&quot;poem&quot;</span> <span class="fu">&gt;&gt;=</span> <span class="fu">putStr</span> <span class="fu">.</span> process<br /><br />process t <span class="fu">=</span> <span class="fu">unlines</span> (<span class="fu">sort</span> (<span class="fu">lines</span> t))</code></pre>
-<p>Put that in a file named <code>Part.hs</code> and then at the shell:</p>
+<p>Put that in a file named <code>Part1.hs</code> and then at the shell:</p>
<pre class="sourceCode"><code class="sourceCode bash">runhaskell Part1.hs</code></pre>
</div>
<div class="slide">
-<h1 id="ignoring-the-main-behind-the-curtain...">Ignoring the main behind the curtain...</h1>
+<p>Original poem:</p>
+<pre><code>occasional clouds
+one gets a rest
+from moon-viewing
+</code></pre>
+<p>Program output:</p>
+<pre><code>from moon-viewing
+occasional clouds
+one gets a rest
+</code></pre>
+</div>
+<div class="slide">
+<h1 id="ignoring-the-main-behind-the-curtain...">Ignoring the <code>main</code> behind the curtain...</h1>
<pre class="sourceCode"><code class="sourceCode haskell">process t <span class="fu">=</span> <span class="fu">unlines</span> (<span class="fu">sort</span> (<span class="fu">lines</span> t))</code></pre>
<p>Remember <strong>f(g(x)) = (f⋅g)(x)</strong> from high school algebra?</p>
<pre class="sourceCode"><code class="sourceCode haskell">process' t <span class="fu">=</span> (<span class="fu">unlines</span> <span class="fu">.</span> <span class="fu">sort</span> <span class="fu">.</span> <span class="fu">lines</span>) t</code></pre>
@@ -552,6 +569,11 @@ <h1 id="map-to-the-rescue"><code>map</code> to the rescue:</h1>
<div class="slide">
<h1 id="so-then">So then:</h1>
<pre class="sourceCode"><code class="sourceCode haskell"><span class="ot">indentEachLine </span><span class="ot">::</span> <span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span><br />indentEachLine <span class="fu">=</span> byLines (<span class="fu">map</span> indent)<br /><br /><span class="ot">eachLine </span><span class="ot">::</span> (<span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span>) <span class="ot">-&gt;</span> <span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span><br />eachLine f <span class="fu">=</span> <span class="fu">unlines</span> <span class="fu">.</span> <span class="fu">map</span> f <span class="fu">.</span> <span class="fu">lines</span><br /><br /><span class="ot">indentEachLine' </span><span class="ot">::</span> <span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span><br />indentEachLine' <span class="fu">=</span> eachLine indent</code></pre>
+<p>and we get:</p>
+<pre><code> occasional clouds
+ one gets a rest
+ from moon-viewing
+</code></pre>
</div>
<div class="slide">
<h1 id="but-wait-wheres-the-second-argument-to-map">But wait, where's the second argument to <code>map</code>?</h1>
@@ -562,15 +584,27 @@ <h1 id="but-wait-wheres-the-second-argument-to-map">But wait, where's the second
<div class="slide">
<h1 id="lets-yell">Let's *YELL!*</h1>
<pre class="sourceCode"><code class="sourceCode haskell"><span class="ot">yell </span><span class="ot">::</span> <span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span><br />yell s <span class="fu">=</span> <span class="fu">map</span> <span class="fu">toUpper</span> s <span class="fu">++</span> <span class="st">&quot;!!!&quot;</span><br /><br /><span class="ot">yellEachLine </span><span class="ot">::</span> <span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span><br />yellEachLine <span class="fu">=</span> eachLine yell</code></pre>
+<p>gives</p>
+<pre><code>OCCASIONAL CLOUDS!!!
+ONE GETS A REST!!!
+FROM MOON-VIEWING!!!
+</code></pre>
</div>
<div class="slide">
<h1 id="what-if-we-wanted-it-by-words">What if we wanted it by words?</h1>
<pre class="sourceCode"><code class="sourceCode haskell"><span class="ot">eachWord </span><span class="ot">::</span> (<span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span>) <span class="ot">-&gt;</span> <span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span><br />eachWord f <span class="fu">=</span> <span class="fu">unwords</span> <span class="fu">.</span> <span class="fu">map</span> f <span class="fu">.</span> <span class="fu">words</span><br /><br /><span class="ot">yellEachWord </span><span class="ot">::</span> <span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span><br />yellEachWord <span class="fu">=</span> eachWord yell</code></pre>
<p><em>d'oh!</em></p>
+<pre><code>OCCASIONAL!!! CLOUDS!!! ONE!!! GETS!!! A!!! REST!!! FROM!!! MOON-VIEWING!!!
+</code></pre>
</div>
<div class="slide">
<h1 id="we-want-by-words-by-lines...">We want by words, by lines...</h1>
<pre class="sourceCode"><code class="sourceCode haskell"><span class="ot">eachWordOnEachLine </span><span class="ot">::</span> (<span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span>) <span class="ot">-&gt;</span> <span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span><br />eachWordOnEachLine f <span class="fu">=</span> eachLine (eachWord f)<br /><br /><span class="ot">yellEachWordOnEachLine </span><span class="ot">::</span> <span class="dt">String</span> <span class="ot">-&gt;</span> <span class="dt">String</span><br />yellEachWordOnEachLine <span class="fu">=</span> eachWord' yell</code></pre>
+<p>Ah, got it:</p>
+<pre><code>OCCASIONAL!!! CLOUDS!!!
+ONE!!! GETS!!! A!!! REST!!!
+FROM!!! MOON-VIEWING!!!
+</code></pre>
</div>
<div class="slide">
<h1 id="what-bus-hit-us">What bus hit us?</h1>
@@ -673,7 +707,7 @@ <h1 id="quick-check-em">Quick Check 'em:</h1>
</div>
<div class="slide">
<h1 id="oh-and-some-more-things">Oh, and some more things:</h1>
-<ul class="incremental">
+<ul>
<li>ghci</li>
<li>cabal &amp; hackage</li>
<li>haddock</li>
@@ -682,6 +716,20 @@ <h1 id="oh-and-some-more-things">Oh, and some more things:</h1>
</ul>
</div>
<div class="slide">
+<h1 id="want-a-bigger-helping">Want a bigger helping?</h1>
+<ul>
+<li>Learn You a Haskell for Great Good!</li>
+</ul>
+<p>http://learnyouahaskell.com/</p>
+<ul>
+<li>Real World Haskell</li>
+</ul>
+<p>http://book.realworldhaskell.org/</p>
+<ul>
+<li>Haskell.org</li>
+</ul>
+</div>
+<div class="slide">
<h1 id="thanks">Thanks</h1>
<p>Mark Lentczner</p>
<p><code>mark@glyphic.com</code></p>
View
69 slides.md
@@ -1,4 +1,4 @@
-% Haskell Bits
+% Haskell Amuse Bouche
% Mark Lentczner
% 2011-09-29
@@ -34,6 +34,13 @@
* Be brave
+# Wanna play along?
+
+The slides and code are here:
+
+`https://github.com/mtnviewmark/haskell-amuse-bouche`
+
+
# Something Familiar
~~~~ {.bash}
@@ -68,13 +75,31 @@ main = readFile "poem" >>= putStr . process
process t = unlines (sort (lines t))
~~~~
-Put that in a file named `Part.hs` and then at the shell:
+Put that in a file named `Part1.hs` and then at the shell:
~~~~ {.bash}
runhaskell Part1.hs
~~~~
-# Ignoring the main behind the curtain...
+----
+
+Original poem:
+
+~~~~
+occasional clouds
+one gets a rest
+from moon-viewing
+~~~~
+
+Program output:
+
+~~~~
+from moon-viewing
+occasional clouds
+one gets a rest
+~~~~
+
+# Ignoring the `main` behind the curtain...
~~~~ {.haskell}
process t = unlines (sort (lines t))
@@ -180,6 +205,14 @@ indentEachLine' :: String -> String
indentEachLine' = eachLine indent
~~~~
+and we get:
+
+~~~~
+ occasional clouds
+ one gets a rest
+ from moon-viewing
+~~~~
+
# But wait, where's the second argument to `map`?
Think of `map`s type this way:
@@ -200,6 +233,14 @@ yellEachLine :: String -> String
yellEachLine = eachLine yell
~~~~
+gives
+
+~~~~
+OCCASIONAL CLOUDS!!!
+ONE GETS A REST!!!
+FROM MOON-VIEWING!!!
+~~~~
+
# What if we wanted it by words?
~~~~ {.haskell}
@@ -212,6 +253,10 @@ yellEachWord = eachWord yell
*d'oh!*
+~~~~
+OCCASIONAL!!! CLOUDS!!! ONE!!! GETS!!! A!!! REST!!! FROM!!! MOON-VIEWING!!!
+~~~~
+
# We want by words, by lines...
~~~~ {.haskell}
@@ -222,6 +267,13 @@ yellEachWordOnEachLine :: String -> String
yellEachWordOnEachLine = eachWord' yell
~~~~
+Ah, got it:
+
+~~~~
+OCCASIONAL!!! CLOUDS!!!
+ONE!!! GETS!!! A!!! REST!!!
+FROM!!! MOON-VIEWING!!!
+~~~~
# What bus hit us?
@@ -520,6 +572,17 @@ Whew
* Hoogle
* `#haskell` on `irc.freenode.org`
+# Want a bigger helping?
+
+* Learn You a Haskell for Great Good!
+
+ http://learnyouahaskell.com/
+
+* Real World Haskell
+
+ http://book.realworldhaskell.org/
+
+* Haskell.org
# Thanks
Please sign in to comment.
Something went wrong with that request. Please try again.