<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>brool &#187; xmlrpc</title>
	<atom:link href="http://www.brool.com/index.php/tag/xmlrpc/feed" rel="self" type="application/rss+xml" />
	<link>http://www.brool.com</link>
	<description>brool \brool\ (n.) : a low roar; a deep murmur or humming</description>
	<lastBuildDate>Fri, 20 Jan 2012 07:58:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Haskell To WordPress (Snippet)</title>
		<link>http://www.brool.com/index.php/haskell-to-wordpress-snippet</link>
		<comments>http://www.brool.com/index.php/haskell-to-wordpress-snippet#comments</comments>
		<pubDate>Fri, 10 Apr 2009 08:25:00 +0000</pubDate>
		<dc:creator>tim</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[haxr]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[xmlrpc]]></category>

		<guid isPermaLink="false">http://www.brool.com/?p=291</guid>
		<description><![CDATA[A small snippet of code that demonstrates calling into a WordPress XML-RPC server with Haskell and HaxR. import qualified Data.Map as Map import Data.Maybe import Network.XmlRpc.Client import Network.XmlRpc.Internals &#160; server = &#34;http://yourserver.wordpress.com/xmlrpc.php&#34; &#160; -- extract multiple posts from the XML response extract :: Value -&#62; &#91;Map String Value&#93; extract xmlresp = let ValueArray rs = [...]]]></description>
			<content:encoded><![CDATA[<p>A small snippet of code that demonstrates calling into a WordPress XML-RPC server with Haskell and <a href="http://www.haskell.org/haxr/">HaxR</a>.</p>


<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="haskell"><pre class="de1"><span class="kw1">import</span> <span class="kw1">qualified</span> Data<span class="sy0">.</span>Map <span class="kw1">as</span> Map
<span class="kw1">import</span> Data<span class="sy0">.</span><span class="kw4">Maybe</span>
<span class="kw1">import</span> Network<span class="sy0">.</span>XmlRpc<span class="sy0">.</span>Client
<span class="kw1">import</span> Network<span class="sy0">.</span>XmlRpc<span class="sy0">.</span>Internals
&nbsp;
server <span class="sy0">=</span> <span class="st0">&quot;http://yourserver.wordpress.com/xmlrpc.php&quot;</span>
&nbsp;
<span class="co1">-- extract multiple posts from the XML response</span>
extract <span class="sy0">::</span> Value <span class="sy0">-&gt;</span> <span class="br0">&#91;</span>Map <span class="kw4">String</span> Value<span class="br0">&#93;</span>
extract xmlresp <span class="sy0">=</span> 
    <span class="kw1">let</span> ValueArray rs <span class="sy0">=</span> xmlresp <span class="kw1">in</span>
    <span class="kw3">map</span> <span class="br0">&#40;</span>\v <span class="sy0">-&gt;</span> <span class="kw1">case</span> v <span class="kw1">of</span> 
                  ValueStruct vs <span class="sy0">-&gt;</span> Map<span class="sy0">.</span>fromList vs
                  <span class="sy0">_</span>              <span class="sy0">-&gt;</span> Map<span class="sy0">.</span>fromList <span class="br0">&#91;</span><span class="br0">&#93;</span><span class="br0">&#41;</span> rs
&nbsp;
getRecentPosts <span class="sy0">::</span> <span class="kw4">Int</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span><span class="kw4">Char</span><span class="br0">&#93;</span> <span class="sy0">-&gt;</span> <span class="br0">&#91;</span><span class="kw4">Char</span><span class="br0">&#93;</span> <span class="sy0">-&gt;</span> <span class="kw4">Int</span> <span class="sy0">-&gt;</span> <span class="kw4">IO</span> Value
getRecentPosts <span class="sy0">=</span> remote server <span class="st0">&quot;metaWeblog.getRecentPosts&quot;</span>
&nbsp;
<span class="co1">-- print out the five most recent posts</span>
main <span class="sy0">=</span> <span class="kw1">do</span> result <span class="sy0">&lt;-</span> getRecentPosts <span class="nu0">1</span> <span class="st0">&quot;yourname&quot;</span> <span class="st0">&quot;yourpass&quot;</span> <span class="nu0">5</span>
          <span class="kw1">let</span> posts <span class="sy0">=</span> extract result
          <span class="kw3">mapM_</span> <span class="br0">&#40;</span>\p <span class="sy0">-&gt;</span> <span class="kw3">print</span> <span class="sy0">$</span> fromJust <span class="sy0">$</span> Map<span class="sy0">.</span><span class="kw3">lookup</span> <span class="st0">&quot;title&quot;</span> p<span class="br0">&#41;</span> posts</pre></div></div></div></div></div></div></div>


]]></content:encoded>
			<wfw:commentRss>http://www.brool.com/index.php/haskell-to-wordpress-snippet/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

