<?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/"
		>
<channel>
	<title>Comments on: A better environment for shell scripting</title>
	<atom:link href="http://changelog.complete.org/archives/587-a-better-environment-for-shell-scripting/feed" rel="self" type="application/rss+xml" />
	<link>http://changelog.complete.org/archives/587-a-better-environment-for-shell-scripting</link>
	<description>Viewpoints on technology, society, and government</description>
	<lastBuildDate>Thu, 29 Jul 2010 17:30:25 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: weakish</title>
		<link>http://changelog.complete.org/archives/587-a-better-environment-for-shell-scripting/comment-page-1#comment-3107</link>
		<dc:creator>weakish</dc:creator>
		<pubDate>Wed, 21 Jan 2009 09:12:28 +0000</pubDate>
		<guid isPermaLink="false">http://changelog2.complete.org/archives/587-a-better-environment-for-shell-scripting.html#comment-3107</guid>
		<description>Have you heard about HsShellScript?

http://www.volker-wysk.de/hsshellscript/</description>
		<content:encoded><![CDATA[<p>Have you heard about HsShellScript?</p>
<p><a href="http://www.volker-wysk.de/hsshellscript/" rel="nofollow">http://www.volker-wysk.de/hsshellscript/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Goerzen</title>
		<link>http://changelog.complete.org/archives/587-a-better-environment-for-shell-scripting/comment-page-1#comment-1407</link>
		<dc:creator>John Goerzen</dc:creator>
		<pubDate>Mon, 05 Mar 2007 01:10:44 +0000</pubDate>
		<guid isPermaLink="false">http://changelog2.complete.org/archives/587-a-better-environment-for-shell-scripting.html#comment-1407</guid>
		<description>What you&#039;re talking about is a weakness in HSH, not in Haskell itself.  I simply haven&#039;t yet coded up support to let someone retrieve output even in the event of an error.  The infrastructure permits it; I just haven&#039;t gotten to it yet.

catch is generally pretty easy to use; you might look at the various info in the library reference for Control.Exception for more info.

The general idea of catch is this.  You pass it two functions.  The first is the action you want to perform.  If it raises no error, catch returns its return value unmodified.  If it raises an exception, catch calls your second function, passing the exception in as an argument, and returns the return value of that function to the program (assuming your second function doesn&#039;t re-raise the exception itself).  HSH provides some utilities that let you catch only shell command exceptions, BTW.

There are other functions such as bracket that are akin to Python&#039;s &quot;finally&quot;, which ensure that certain tasks are carried out after an operation is complete, whether or not it was successful.

Hope that helps.</description>
		<content:encoded><![CDATA[<p>What you&#8217;re talking about is a weakness in HSH, not in Haskell itself.  I simply haven&#8217;t yet coded up support to let someone retrieve output even in the event of an error.  The infrastructure permits it; I just haven&#8217;t gotten to it yet.</p>
<p>catch is generally pretty easy to use; you might look at the various info in the library reference for Control.Exception for more info.</p>
<p>The general idea of catch is this.  You pass it two functions.  The first is the action you want to perform.  If it raises no error, catch returns its return value unmodified.  If it raises an exception, catch calls your second function, passing the exception in as an argument, and returns the return value of that function to the program (assuming your second function doesn&#8217;t re-raise the exception itself).  HSH provides some utilities that let you catch only shell command exceptions, BTW.</p>
<p>There are other functions such as bracket that are akin to Python&#8217;s &#8220;finally&#8221;, which ensure that certain tasks are carried out after an operation is complete, whether or not it was successful.</p>
<p>Hope that helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gwern</title>
		<link>http://changelog.complete.org/archives/587-a-better-environment-for-shell-scripting/comment-page-1#comment-1405</link>
		<dc:creator>Gwern</dc:creator>
		<pubDate>Sun, 04 Mar 2007 05:10:22 +0000</pubDate>
		<guid isPermaLink="false">http://changelog2.complete.org/archives/587-a-better-environment-for-shell-scripting.html#comment-1405</guid>
		<description>Yes, this certainly is neat. (Although how hard is &quot;$@&quot;? I know the Bash manuals and FAQs linked to from #bash all say to just use that)

I have a few questions: how far is this going to go, though? Are you going to add in more programs in native Haskell, like the list of simple unix tools &lt;http://haskell.org/haskellwiki/Simple_unix_tools&gt;? Because that&#039;d be pretty neat and would make pipes even more neat.

Also, why wcL and not wcC or wcW? Seems kind of odd to single out the &quot;wc -l&quot; functional of wc for implementation.

Anyway, I&#039;ve already written a somewhat useful program using HSH: &lt;http://en.wikipedia.org/wiki/User:Gwern/Bot&gt; The nice thing about HSH is that it allows me (albeit not entirely easily - type mismatches make things more difficult than it feels like they should be) to do the thinking and hard stuff in Haskell and let the Python (programs from Pywikipediabot) handle the details of actually connecting to Wikipedia and getting and saving articles. I discovered it can be quite painful to really use the monads and I particularly had trouble dealing with errors.

For example, if a Python script errors out saying there&#039;s no page, how does one handle it usefully in the IO monad in Haskell without weird hacks like redirecting output to a file and reading the file in? Eventually I found a way to make catch work for me, but that was seriously not fun to work around.</description>
		<content:encoded><![CDATA[<p>Yes, this certainly is neat. (Although how hard is &#8220;$@&#8221;? I know the Bash manuals and FAQs linked to from #bash all say to just use that)</p>
<p>I have a few questions: how far is this going to go, though? Are you going to add in more programs in native Haskell, like the list of simple unix tools <http ://haskell.org/haskellwiki/Simple_unix_tools>? Because that&#8217;d be pretty neat and would make pipes even more neat.</p>
<p>Also, why wcL and not wcC or wcW? Seems kind of odd to single out the &#8220;wc -l&#8221; functional of wc for implementation.</p>
<p>Anyway, I&#8217;ve already written a somewhat useful program using HSH: </http><http ://en.wikipedia.org/wiki/User:Gwern/Bot> The nice thing about HSH is that it allows me (albeit not entirely easily &#8211; type mismatches make things more difficult than it feels like they should be) to do the thinking and hard stuff in Haskell and let the Python (programs from Pywikipediabot) handle the details of actually connecting to Wikipedia and getting and saving articles. I discovered it can be quite painful to really use the monads and I particularly had trouble dealing with errors.</p>
<p>For example, if a Python script errors out saying there&#8217;s no page, how does one handle it usefully in the IO monad in Haskell without weird hacks like redirecting output to a file and reading the file in? Eventually I found a way to make catch work for me, but that was seriously not fun to work around.</http></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Nusinow</title>
		<link>http://changelog.complete.org/archives/587-a-better-environment-for-shell-scripting/comment-page-1#comment-1404</link>
		<dc:creator>David Nusinow</dc:creator>
		<pubDate>Sat, 03 Mar 2007 16:35:19 +0000</pubDate>
		<guid isPermaLink="false">http://changelog2.complete.org/archives/587-a-better-environment-for-shell-scripting.html#comment-1404</guid>
		<description>This looks very cool! I&#039;ve been trying to find time to learn haskell, but I generally spend most of my time doing Debian work, which really involves lots of shell scripting. This will finally give me the chance to do both! I&#039;m looking forward to having it enter the archive.</description>
		<content:encoded><![CDATA[<p>This looks very cool! I&#8217;ve been trying to find time to learn haskell, but I generally spend most of my time doing Debian work, which really involves lots of shell scripting. This will finally give me the chance to do both! I&#8217;m looking forward to having it enter the archive.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
