<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>ByteLabs: Tag Haskell</title>
    <link>http://blog.solaris.bytelabs.org/articles/tag/haskell</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>additions to a vast pool of entropy by Igor and Ines</description>
    <item>
      <title>Playing with Rank-N Types</title>
      <description>The following shows some dummy Haskell example code that demonstrates the usage of rank-n types:
&lt;pre&gt;&lt;code&gt;{-# LANGUAGE RankNTypes #-}
module Main (main) where
-- g1: identity function
-- GHC implicitely quantifies it to: forall a. a -&amp;gt; a
g1 :: a -&amp;gt; a
g1 x = x
-- g2: Rank2Type
g2 :: (forall a. a -&amp;gt; a) -&amp;gt; (Bool, Char)
g2 f = (f True, f 'a')
-- g3: Rank3Type
g3 :: ((forall a. a -&amp;gt; a) -&amp;gt; (Bool, Char)) -&amp;gt; (Char, Bool)
g3 f = (\x -&amp;gt; (snd x, fst x)) (f g1)
-- g4: Rank4Type
g4 :: (((forall a. a -&amp;gt; a) -&amp;gt; (Bool, Char)) -&amp;gt; (Char, Bool)) -&amp;gt;
         (Bool, Char)
g4 f = (\x -&amp;gt; (snd x, fst x)) (f g2)

main :: IO ()
main = do
  putStrLn "Rank-2 Example:" 
  putStrLn . show . fst . g2 $ g1
  putStrLn . show . snd . g2 $ g1
  putStrLn "Rank-3 Example:" 
  putStrLn . show . fst . g3 $ g2
  putStrLn . show . snd . g3 $ g2
  putStrLn "Rank-4 Example:" 
  putStrLn . show . fst . g4 $ g3
  putStrLn . show . snd . g4 $ g3
&lt;/code&gt;&lt;/pre&gt;

 If you want to see more &amp;#8216;useful&amp;#8217; examples have a look at the paper &lt;a href="http://research.microsoft.com/~simonpj/papers/higher-rank/putting.pdf"&gt;Practical Type Inference for Arbitrary-Rank Types&lt;/a&gt;.</description>
      <pubDate>Sun, 10 Aug 2008 12:51:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:488c2a29-77c7-4c9f-8e1e-e7a1843f8766</guid>
      <author>igor</author>
      <link>http://blog.solaris.bytelabs.org/articles/2008/08/10/playing-with-rank-n-types</link>
      <category>Hacking and Computers</category>
      <category>Haskell</category>
      <category>Types</category>
    </item>
    <item>
      <title>Build Darcs with GHC 6.8.1</title>
      <description>&lt;p&gt;Download stable or pre-release &lt;a href="http//darcs.net"&gt;darcs&lt;/a&gt; source distribution.  You need to edit two files, namely &lt;strong&gt;aclocal.m4&lt;/strong&gt; and &lt;strong&gt;autoconf.mk&lt;/strong&gt;:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;aclocal.m4&lt;/strong&gt;: add the following before the &lt;strong&gt;AC_MSG_RESULT([failed])&lt;/strong&gt; line in the &lt;strong&gt;&lt;span class="caps"&gt;WORKAROUND&lt;/span&gt;_openFd&lt;/strong&gt; section:&lt;/li&gt;
	&lt;/ul&gt;


&lt;pre&gt;
&lt;code&gt;AC_MSG_RESULT([okay])
IMPORT_WORKAROUND([
   import qualified GHC.Handle ( fdToHandle' )
   import System.IO ( Handle, IOMode )
   import System.Posix.Internals ( FDType )
   import qualified GHC.IOBase ( FD )
])
CODE_WORKAROUND([[
  {- 
   Work around change in the GHC.Handle.fdToHandle' API.
  -}
openFd :: GHC.IOBase.FD -&amp;gt; Maybe FDType -&amp;gt; FilePath -&amp;gt; IOMode -&amp;gt; Bool -&amp;gt; Bool -&amp;gt; IO Handle
openFd fd x y z a b = GHC.Handle.fdToHandle' fd x b y z a
]]),&lt;/code&gt;
&lt;/pre&gt;

	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;autoconf.mk&lt;/strong&gt;: add &lt;strong&gt;-package containers&lt;/strong&gt; to &lt;span class="caps"&gt;GHCFLAGS&lt;/span&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;run &lt;strong&gt;autoconf&lt;/strong&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Now you are ready and set to build darcs with &lt;a href="http://www.haskell.org/ghc/download_ghc_681.html"&gt;&lt;span class="caps"&gt;GHC  6&lt;/span&gt;.8.1&lt;/a&gt;. The unstable darcs branch works out of the box with &lt;span class="caps"&gt;GHC 6&lt;/span&gt;.8.1.&lt;/p&gt;</description>
      <pubDate>Thu, 22 Nov 2007 14:25:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:70fd0401-161c-42ce-9f46-7a0f08781ab6</guid>
      <author>igor</author>
      <link>http://blog.solaris.bytelabs.org/articles/2007/11/22/build-darcs-with-ghc-6-8-1</link>
      <category>Hacking and Computers</category>
      <category>Haskell</category>
      <category>darcs</category>
    </item>
    <item>
      <title>GHC 6.8.1 is out</title>
      <description>A new version of &lt;a href="http://haskell.org/ghc/download_ghc_681.html"&gt;&lt;span class="caps"&gt;GHC&lt;/span&gt;&lt;/a&gt; is out. Significant changes since the last release:
	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://haskell.org/haskellwiki/Haskell_program_coverage"&gt;Haskell Program Coverage&lt;/a&gt; (hpc)&lt;/li&gt;
		&lt;li&gt;GHCi includes a &lt;a href="http://www.haskell.org/~simonmar/papers/ghci-debug.pdf"&gt;debugger&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;The code generator uses &lt;a href="http://research.microsoft.com/~simonpj/papers/ptr-tag/index.htm"&gt;pointer tagging&lt;/a&gt; (which should mean most
  code improves by 10-15%, and as a result the compiler is also faster)&lt;/li&gt;
	&lt;/ul&gt;


The full release notes are at:
	&lt;ul&gt;
	&lt;li&gt;  &lt;a href="http://haskell.org/ghc/docs/6.8.1/html/users_guide/release-6-8-1.html"&gt;http://haskell.org/ghc/docs/6.8.1/html/users_guide/release-6-8-1.html&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;</description>
      <pubDate>Sun, 04 Nov 2007 19:26:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:8bb19cab-b297-40f6-bb07-97b6a7d727e7</guid>
      <author>igor</author>
      <link>http://blog.solaris.bytelabs.org/articles/2007/11/04/ghc-6-8-1-is-out</link>
      <category>Hacking and Computers</category>
      <category>Haskell</category>
    </item>
    <item>
      <title>HBURG on HackageDB</title>
      <description>&lt;p&gt;&lt;a href="http://www.bytelabs.org/hburg.html"&gt;&lt;span class="caps"&gt;HBURG&lt;/span&gt;&lt;/a&gt; is now also available via the &lt;a href="http://hackage.haskell.org/"&gt;Haskell HackageDB&lt;/a&gt; if you follow this &lt;a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/hburg-1.0"&gt;link&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Sat, 11 Aug 2007 15:42:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:69de0821-2a2d-4533-8a2d-e7be61896189</guid>
      <author>igor</author>
      <link>http://blog.solaris.bytelabs.org/articles/2007/08/11/hburg-on-hackagedb</link>
      <category>Hacking and Computers</category>
      <category>Haskell</category>
    </item>
    <item>
      <title>Good Haskell Style</title>
      <description>&lt;p&gt;If you have written lots of &lt;a href="http://www.haskell.com/"&gt;Haskell&lt;/a&gt; code and used tabs for indentation because you have not yet read &lt;a href="http://urchin.earth.li/~ian/style/haskell.html"&gt;Good Haskell Style&lt;/a&gt; by &lt;a href="http://web.comlab.ox.ac.uk/oucl/work/ian.lynagh/"&gt;Ian Lynagh&lt;/a&gt;, then the following little Perl snippet may help you to easily convert your &lt;a href="http://www.haskell.com/"&gt;Haskell&lt;/a&gt; code:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;code&gt;perl -e '($_ = join "",&amp;lt;&amp;gt;) =~ s/(\t)/    /g; print;'&lt;/code&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;If you are using &lt;a href="http://www.macromates.com/"&gt;TextMate&lt;/a&gt; you can easily use this snippet as a &lt;em&gt;Filter Through Command&amp;#8230;&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Sources:&lt;/strong&gt;&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.nabble.com/Good-Haskell-Style-t4200373.html"&gt;Ian Lynagh post&lt;/a&gt; to the Haskell Libraries list.&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://urchin.earth.li/~ian/style/haskell.html"&gt;Good Haskell Style&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;</description>
      <pubDate>Sat, 11 Aug 2007 15:28:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:acbfd6e0-af12-43cc-8774-98c8a25e230b</guid>
      <author>igor</author>
      <link>http://blog.solaris.bytelabs.org/articles/2007/08/11/good-haskell-style</link>
      <category>Diploma Thesis</category>
      <category>Hacking and Computers</category>
      <category>Haskell</category>
    </item>
    <item>
      <title>HBURG Version 1.0 Released</title>
      <description>&lt;p&gt;&lt;a href="http://www.bytelabs.org/hburg.html"&gt;&lt;span class="caps"&gt;HBURG&lt;/span&gt;&lt;/a&gt; (Haskell Bottom Up Rewrite Generator) version 1.0 is &lt;a href="http://www.bytelabs.org/hburg.html"&gt;available&lt;/a&gt; as of today! As always there is still work to do, but it is finally the time to release a first version. A very simple example compiler showing how to use &lt;span class="caps"&gt;HBURG&lt;/span&gt; in the compiler design and development process is provided as well.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.bytelabs.org/hburg.html"&gt;Please visit the &lt;span class="caps"&gt;HBURG&lt;/span&gt; project website&lt;/a&gt; for more information.&lt;/li&gt;
	&lt;/ul&gt;</description>
      <pubDate>Wed, 25 Jul 2007 14:00:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:5da05bd4-cfca-4582-9463-60fd0ee8f3d1</guid>
      <author>igor</author>
      <link>http://blog.solaris.bytelabs.org/articles/2007/07/25/hburg-version-1-0-released</link>
      <category>Fun Stuff</category>
      <category>Diploma Thesis</category>
      <category>Hacking and Computers</category>
      <category>Haskell</category>
      <category>HBURG</category>
    </item>
    <item>
      <title>Ghc 6.6.1 on Mac OS X</title>
      <description>Today I finally went ahead and upgraded &lt;a href="http://www.haskell.org/ghc"&gt;Ghc&lt;/a&gt; to version &lt;a href="http://www.haskell.org/ghc/docs/6.6.1/html/users_guide/release-6-6-1.html"&gt;6.6.1&lt;/a&gt;. On Max &lt;span class="caps"&gt;OS X&lt;/span&gt; Tiger I additionally needed to install the &lt;span class="caps"&gt;GNU&lt;/span&gt;-Readline Framework as described in &lt;a href="http://www.haskell.org/pipermail/glasgow-haskell-users/2007-May/012576.html"&gt;this post&lt;/a&gt;. The installation went really fine but when trying to link executable programs &lt;code&gt;ld&lt;/code&gt; would throw up and say something along the line:
	&lt;ul&gt;
	&lt;li&gt;... the table of contents for &lt;code&gt;*.a&lt;/code&gt; archives are out of date and that &lt;code&gt;ranlib(1)&lt;/code&gt; should be re-run.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Oh well, life is imperfect but the following solves the problem:&lt;/p&gt;


	&lt;p&gt;&lt;code&gt; $ cd /usr/local/lib/ghc-6.6.1/&lt;/code&gt; &lt;br/&gt;
&lt;code&gt; $ sudo sh  -c "ls *.a | xargs ranlib"&lt;/code&gt;&lt;/p&gt;</description>
      <pubDate>Tue, 29 May 2007 15:35:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:33023a49-3363-4b30-a3b0-d3a55be4e5f6</guid>
      <author>igor</author>
      <link>http://blog.solaris.bytelabs.org/articles/2007/05/29/ghc-6-6-1-on-mac-os-x</link>
      <category>Ghc</category>
      <category>Haskell</category>
    </item>
  </channel>
</rss>
