<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: ANN: hvac 0.1b, a transactional, declarative framework for lightweight web applications</title>
	<atom:link href="http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/feed/" rel="self" type="application/rss+xml" />
	<link>http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/</link>
	<description>intercalate " " . ("Haskell" :) . (:[]) $  "Blog"</description>
	<lastBuildDate>Fri, 12 Nov 2010 19:50:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Demystifying hvac &#8211; Making sense of all the symbols. &#171; archive from dbpatterson.com</title>
		<link>http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/#comment-247</link>
		<dc:creator><![CDATA[Demystifying hvac &#8211; Making sense of all the symbols. &#171; archive from dbpatterson.com]]></dc:creator>
		<pubDate>Tue, 08 Sep 2009 19:22:27 +0000</pubDate>
		<guid isPermaLink="false">http://fmapfixreturn.wordpress.com/?p=11#comment-247</guid>
		<description><![CDATA[[...] is a new, extremely lightweight web framework written in haskell. To learn more about it, check out the hvac announcement . The purpose of this short article is to try to make sense of all the symbols that you will [...]]]></description>
		<content:encoded><![CDATA[<p>[...] is a new, extremely lightweight web framework written in haskell. To learn more about it, check out the hvac announcement . The purpose of this short article is to try to make sense of all the symbols that you will [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zoneaire</title>
		<link>http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/#comment-246</link>
		<dc:creator><![CDATA[Zoneaire]]></dc:creator>
		<pubDate>Thu, 02 Apr 2009 17:35:58 +0000</pubDate>
		<guid isPermaLink="false">http://fmapfixreturn.wordpress.com/?p=11#comment-246</guid>
		<description><![CDATA[Very interesting program, and intelligently made.]]></description>
		<content:encoded><![CDATA[<p>Very interesting program, and intelligently made.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Art Silver</title>
		<link>http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/#comment-244</link>
		<dc:creator><![CDATA[Art Silver]]></dc:creator>
		<pubDate>Wed, 18 Mar 2009 00:36:11 +0000</pubDate>
		<guid isPermaLink="false">http://fmapfixreturn.wordpress.com/?p=11#comment-244</guid>
		<description><![CDATA[Nice framework idea. Most tend to be bloated and try to be the end all be all of coding.]]></description>
		<content:encoded><![CDATA[<p>Nice framework idea. Most tend to be bloated and try to be the end all be all of coding.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sclv</title>
		<link>http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/#comment-59</link>
		<dc:creator><![CDATA[sclv]]></dc:creator>
		<pubDate>Sat, 12 Apr 2008 02:28:01 +0000</pubDate>
		<guid isPermaLink="false">http://fmapfixreturn.wordpress.com/?p=11#comment-59</guid>
		<description><![CDATA[I should also note that thinking through the file stuff after that last reply, I now realize that flocks are more trouble than they&#039;re worth, and one can use &quot;proxy&quot; TVars to get nice optimistic behavior instead at a much lower overhead and less code (and with more portability to boot!), which should make writing a useful ReadDir less painful too.]]></description>
		<content:encoded><![CDATA[<p>I should also note that thinking through the file stuff after that last reply, I now realize that flocks are more trouble than they&#8217;re worth, and one can use &#8220;proxy&#8221; TVars to get nice optimistic behavior instead at a much lower overhead and less code (and with more portability to boot!), which should make writing a useful ReadDir less painful too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sclv</title>
		<link>http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/#comment-58</link>
		<dc:creator><![CDATA[sclv]]></dc:creator>
		<pubDate>Fri, 11 Apr 2008 16:30:59 +0000</pubDate>
		<guid isPermaLink="false">http://fmapfixreturn.wordpress.com/?p=11#comment-58</guid>
		<description><![CDATA[That&#039;s a good question. As you can see, hvac prevents unrestricted IO because that would break transactional semantics. As is, hvac, uses posix flocks to keep its file operations properly atomic. A simple solution would be to write a function hvReadDir (MonadSTM m) :: FilePath -&gt; m String; hvReadDir = liftSTM . unsafeIOToSTM

liftSTM and the MonadSTM class are exported from Network.Framework.HVAC.Classes, which isn&#039;t usually exposed. I suppose I could expose it, making clear that this was internal stuff provided.

The problem with this is that it is not strictly transactional, as a file may be added or deleted between the time you read the directory and the time you take the next action on the directory -- i.e. if you&#039;re creating a file if it does not exist, by the time you create the file, it may actually exist.

This problem exists on essentially all webapp frameworks, but most don&#039;t force you to think about it. This being a Haskell framework that tries to act like Haskell, it does. After all, far too much web code is written with the assumption of atomic transactional semantics but without any implementation of it. :-) 

You can look at the code for hvReadFile to get an idea of how I handle flocks. But to extend this treatment means that reading a directory, writing a file, and reading a file would all *also* (or, actually, only) need to lock on the directory level rather than the file level, which is somewhat inefficient. The point being that optimistic transactional semantics on a filesystem are a somewhat hard problem, although not massively so, and require some thinking about.

The safest and most efficient way would probably be to read your directory contents into a tvar at the start of an app, and every time a file is written to the directory (within hvac) to update the tvar. This keeps everything within the existent atomic and transactional bounds, and is actually probably faster to boot, whether or not one is worried about such things.

If the files are being written by an external process, then one would need to also launch a worker thread to periodically update the tvar with the most current information.

A bit more heavyweight, but similar to how &quot;genuine&quot; web galleries work is to keep your associations between file information and the actual filename in a database table.

A photo gallery sample app would be very useful to illustrate these techniques and explore the problem space.

Of course, there may be a simpler solution and I could just be overcomplicating things. Given that your hello world is a web gallery, you must have some experience thinking about this, and I&#039;d appreciate your thoughts. :-)

One piece that hvac does lack at this point is a writeUniqueFile function that guarantees that the file written to does not already exist. It&#039;s easy enough to implement one, I suppose, but it is something that should be handled transparently and behind-the-scenes, but I haven&#039;t felt a strong pressure to. If you&#039;d find that useful, I could move it up my priorities list.]]></description>
		<content:encoded><![CDATA[<p>That&#8217;s a good question. As you can see, hvac prevents unrestricted IO because that would break transactional semantics. As is, hvac, uses posix flocks to keep its file operations properly atomic. A simple solution would be to write a function hvReadDir (MonadSTM m) :: FilePath -&gt; m String; hvReadDir = liftSTM . unsafeIOToSTM</p>
<p>liftSTM and the MonadSTM class are exported from Network.Framework.HVAC.Classes, which isn&#8217;t usually exposed. I suppose I could expose it, making clear that this was internal stuff provided.</p>
<p>The problem with this is that it is not strictly transactional, as a file may be added or deleted between the time you read the directory and the time you take the next action on the directory &#8212; i.e. if you&#8217;re creating a file if it does not exist, by the time you create the file, it may actually exist.</p>
<p>This problem exists on essentially all webapp frameworks, but most don&#8217;t force you to think about it. This being a Haskell framework that tries to act like Haskell, it does. After all, far too much web code is written with the assumption of atomic transactional semantics but without any implementation of it. :-) </p>
<p>You can look at the code for hvReadFile to get an idea of how I handle flocks. But to extend this treatment means that reading a directory, writing a file, and reading a file would all *also* (or, actually, only) need to lock on the directory level rather than the file level, which is somewhat inefficient. The point being that optimistic transactional semantics on a filesystem are a somewhat hard problem, although not massively so, and require some thinking about.</p>
<p>The safest and most efficient way would probably be to read your directory contents into a tvar at the start of an app, and every time a file is written to the directory (within hvac) to update the tvar. This keeps everything within the existent atomic and transactional bounds, and is actually probably faster to boot, whether or not one is worried about such things.</p>
<p>If the files are being written by an external process, then one would need to also launch a worker thread to periodically update the tvar with the most current information.</p>
<p>A bit more heavyweight, but similar to how &#8220;genuine&#8221; web galleries work is to keep your associations between file information and the actual filename in a database table.</p>
<p>A photo gallery sample app would be very useful to illustrate these techniques and explore the problem space.</p>
<p>Of course, there may be a simpler solution and I could just be overcomplicating things. Given that your hello world is a web gallery, you must have some experience thinking about this, and I&#8217;d appreciate your thoughts. :-)</p>
<p>One piece that hvac does lack at this point is a writeUniqueFile function that guarantees that the file written to does not already exist. It&#8217;s easy enough to implement one, I suppose, but it is something that should be handled transparently and behind-the-scenes, but I haven&#8217;t felt a strong pressure to. If you&#8217;d find that useful, I could move it up my priorities list.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: plop</title>
		<link>http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/#comment-56</link>
		<dc:creator><![CDATA[plop]]></dc:creator>
		<pubDate>Fri, 11 Apr 2008 06:49:42 +0000</pubDate>
		<guid isPermaLink="false">http://fmapfixreturn.wordpress.com/?p=11#comment-56</guid>
		<description><![CDATA[Hello =)

I don&#039;t know if it&#039;s the correct place to ask you about your (nice) framework :).

From the type signature of the controller function, one would guess that you cannot do arbitrary IO operations ? (This is why you provide the hv*File function).

But, if I need to perform something like, listing the content of a directory (being a web developper discovering Haskell, my hello world is implementing a web gallery), what would I need to do that don&#039;t use unsafePerformIO and it&#039;s friends ?]]></description>
		<content:encoded><![CDATA[<p>Hello =)</p>
<p>I don&#8217;t know if it&#8217;s the correct place to ask you about your (nice) framework :).</p>
<p>From the type signature of the controller function, one would guess that you cannot do arbitrary IO operations ? (This is why you provide the hv*File function).</p>
<p>But, if I need to perform something like, listing the content of a directory (being a web developper discovering Haskell, my hello world is implementing a web gallery), what would I need to do that don&#8217;t use unsafePerformIO and it&#8217;s friends ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Patterson</title>
		<link>http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/#comment-41</link>
		<dc:creator><![CDATA[Daniel Patterson]]></dc:creator>
		<pubDate>Tue, 01 Apr 2008 20:47:57 +0000</pubDate>
		<guid isPermaLink="false">http://fmapfixreturn.wordpress.com/?p=11#comment-41</guid>
		<description><![CDATA[Hmm.. another minor fix for the example code. Lighty is being a pain (at least here, with my version), the fix being adding:
&quot;check-local&quot; =&gt; &quot;disable&quot; 
to the fastcgi.server section of the config. Without that it pretty consistently 404s everything (because it is looking for the file hvac-board, etc).

Also, I&#039;m not sure what platform you are developing on but here (on linux), case sensitivity is killing the import Examples.Common - the examples directory needs to be &quot;Examples&quot; and common.hs needs to be &quot;Common.hs&quot;. People on #haskell pointed out that both Windows and OSX wouldn&#039;t have that problem...

Perhaps there is a better place to voice these concerns (bug tracker? email? #haskell?), but with the most recent patch (32), &quot;hs for fastcgi&quot;, linking is broken with the example hvac-board.hs - I can give you exact errors if you&#039;d like, but for now I just am working with the previous revision... Perhaps you are just in the middle of changing things, and it will be resolved.

(I&#039;ve temporarily given up getting it working on nginx, but I&#039;ll get back to that).]]></description>
		<content:encoded><![CDATA[<p>Hmm.. another minor fix for the example code. Lighty is being a pain (at least here, with my version), the fix being adding:<br />
&#8220;check-local&#8221; =&gt; &#8220;disable&#8221;<br />
to the fastcgi.server section of the config. Without that it pretty consistently 404s everything (because it is looking for the file hvac-board, etc).</p>
<p>Also, I&#8217;m not sure what platform you are developing on but here (on linux), case sensitivity is killing the import Examples.Common &#8211; the examples directory needs to be &#8220;Examples&#8221; and common.hs needs to be &#8220;Common.hs&#8221;. People on #haskell pointed out that both Windows and OSX wouldn&#8217;t have that problem&#8230;</p>
<p>Perhaps there is a better place to voice these concerns (bug tracker? email? #haskell?), but with the most recent patch (32), &#8220;hs for fastcgi&#8221;, linking is broken with the example hvac-board.hs &#8211; I can give you exact errors if you&#8217;d like, but for now I just am working with the previous revision&#8230; Perhaps you are just in the middle of changing things, and it will be resolved.</p>
<p>(I&#8217;ve temporarily given up getting it working on nginx, but I&#8217;ll get back to that).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bloggersiva</title>
		<link>http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/#comment-40</link>
		<dc:creator><![CDATA[bloggersiva]]></dc:creator>
		<pubDate>Mon, 31 Mar 2008 11:25:13 +0000</pubDate>
		<guid isPermaLink="false">http://fmapfixreturn.wordpress.com/?p=11#comment-40</guid>
		<description><![CDATA[can you tell me some sites which provides the command set of microsoft SQL server 2005 for the beginners / Developers.....]]></description>
		<content:encoded><![CDATA[<p>can you tell me some sites which provides the command set of microsoft SQL server 2005 for the beginners / Developers&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bloggersiva</title>
		<link>http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/#comment-39</link>
		<dc:creator><![CDATA[bloggersiva]]></dc:creator>
		<pubDate>Mon, 31 Mar 2008 11:24:13 +0000</pubDate>
		<guid isPermaLink="false">http://fmapfixreturn.wordpress.com/?p=11#comment-39</guid>
		<description><![CDATA[nIce one &amp; useful too]]></description>
		<content:encoded><![CDATA[<p>nIce one &amp; useful too</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sclv</title>
		<link>http://fmapfixreturn.wordpress.com/2008/03/23/ann-hvac-01b-a-transactional-declarative-framework-for-lightweight-web-applications/#comment-38</link>
		<dc:creator><![CDATA[sclv]]></dc:creator>
		<pubDate>Mon, 31 Mar 2008 05:28:22 +0000</pubDate>
		<guid isPermaLink="false">http://fmapfixreturn.wordpress.com/?p=11#comment-38</guid>
		<description><![CDATA[Thanks for the fixes! checked in and pushed.]]></description>
		<content:encoded><![CDATA[<p>Thanks for the fixes! checked in and pushed.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
