<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2718899149184968495</id><updated>2012-02-16T08:03:19.191+01:00</updated><category term='Haskell'/><category term='learning'/><title type='text'>Coding and stuff</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codingnstuff.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2718899149184968495/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://codingnstuff.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Coder</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2718899149184968495.post-326902713118033636</id><published>2011-02-19T11:44:00.005+01:00</published><updated>2011-02-24T05:13:43.901+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='learning'/><category scheme='http://www.blogger.com/atom/ns#' term='Haskell'/><title type='text'>Learning Haskell</title><content type='html'>As an always curious programmer, I want to learn interesting programming languages and new paradigms. &lt;a href="http://en.wikipedia.org/wiki/Haskell_%28programming_language%29"&gt;Haskell&lt;/a&gt; is one of the languages I think would be interesting to learn. It is a &lt;a href="http://en.wikipedia.org/wiki/Purely_functional"&gt;purely funtional&lt;/a&gt; language, giving me the opportunity to learn a new paradigm - &lt;a href="http://en.wikipedia.org/wiki/Functional_programming"&gt;functional programming&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;My earlier attempts at learning this language has not succeeded, mainly because of my short attention span and general lack of patience. I will now make a new attempt, and document the learning process in this blog. I hope that blogging will be the extra push needed to stay focused. It will also hopefully be of use for other programmers wanting to learn Haskell.&lt;br /&gt;&lt;br /&gt;So, lets start with the traditional first program in a new language - "Hello, World!":&lt;br /&gt;&lt;pre&gt;&lt;code&gt;main=putStrLn "Hello, World!"&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;There are several compilers for Haskell. I choose to use the &lt;a href="http://www.haskell.org/ghc/"&gt;Glasgow Haskell Compiler&lt;/a&gt;. To compile this code (stored in the file &lt;span style="font-style: italic;"&gt;hello.hs&lt;/span&gt;), I used the following command line:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;ghc --make hello.hs&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;This will, in UNIX-like systems, create an executable file &lt;span style="font-style: italic;"&gt;hello&lt;/span&gt;, which can be run simply by entering:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;./hello&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;As expected, we get the following output:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;Hello, World!&lt;/code&gt;&lt;/pre&gt;So, I managed to write, compile and run a program that prints one line of text on standard output. Not very interesting. What is more interesting is how this single line of source code made the program produce this output. In an &lt;a href="http://en.wikipedia.org/wiki/Imperative_programming"&gt;imperative programming language&lt;/a&gt; that is quite simple - some boilerplate code, combined with a call to a function printing its argument.&lt;br /&gt;&lt;br /&gt;In Haskell, it is a little more complicated. Functions can't have side effects, like printing something, and everything happens inside a function called &lt;span style="font-style: italic;"&gt;main&lt;/span&gt;. In this case, &lt;span style="font-style: italic;"&gt;main&lt;/span&gt; calls another function (&lt;span style="font-style: italic;"&gt;putStrLn&lt;/span&gt;), accepting a string as its only argument. Even though the name &lt;span style="font-style: italic;"&gt;putStrLn&lt;/span&gt; suggests it will write a string to somewhere, it doesn't actually do that. It only returns the &lt;a href="http://www.haskell.org/haskellwiki/Introduction_to_Haskell_IO/Actions"&gt;action&lt;/a&gt; of writing the string. This action is a special value telling Haskell to perform it, if it is returned by &lt;span style="font-style: italic;"&gt;main&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;There are other actions than just printing a string. We can read from a file or standard input. Actions can also be combined, building up a sequence of IO actions. More about that later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2718899149184968495-326902713118033636?l=codingnstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codingnstuff.blogspot.com/feeds/326902713118033636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2718899149184968495&amp;postID=326902713118033636' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2718899149184968495/posts/default/326902713118033636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2718899149184968495/posts/default/326902713118033636'/><link rel='alternate' type='text/html' href='http://codingnstuff.blogspot.com/2011/02/learning-haskell.html' title='Learning Haskell'/><author><name>Coder</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2718899149184968495.post-874928169875016819</id><published>2007-05-03T12:58:00.000+02:00</published><updated>2007-05-03T13:01:15.372+02:00</updated><title type='text'>First blog post</title><content type='html'>This is the first post in my blog about coding (and stuff). More interesting content wil soon appear.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2718899149184968495-874928169875016819?l=codingnstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codingnstuff.blogspot.com/feeds/874928169875016819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2718899149184968495&amp;postID=874928169875016819' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2718899149184968495/posts/default/874928169875016819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2718899149184968495/posts/default/874928169875016819'/><link rel='alternate' type='text/html' href='http://codingnstuff.blogspot.com/2007/05/first-blog-post.html' title='First blog post'/><author><name>Coder</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
