<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-13132</id>
	<title>Nabble - Haskell - Haskell-Cafe</title>
	<updated>2009-11-10T08:46:57Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/Haskell---Haskell-Cafe-f13132.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Haskell---Haskell-Cafe-f13132.html" />
	<subtitle type="html">The Haskell Cafe</subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26286883</id>
	<title>Sending patches to ghc related repositories</title>
	<published>2009-11-10T08:46:57Z</published>
	<updated>2009-11-10T08:46:57Z</updated>
	<author>
		<name>Maurí­cio CA</name>
	</author>
	<content type="html">Hi, all,
&lt;br&gt;&lt;br&gt;I just tried to send a patch to a ghc tool. I see in hackage that
&lt;br&gt;the maintainer e-mail is '&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26286883&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;cvs-fptools@...&lt;/a&gt;' (package is
&lt;br&gt;hsc2hs). I tried sending darcs patch to this e-mail, but it's
&lt;br&gt;refused as it's not on that server allowed e-mails table.
&lt;br&gt;&lt;br&gt;The patch isn't really important, just a documentation typo,
&lt;br&gt;but I'm curious about what is the proper way to do it.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;Maurício
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26286883&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Sending-patches-to-ghc-related-repositories-tp26286883p26286883.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26286543</id>
	<title>Re: Help Haskell driving Medical Instruments</title>
	<published>2009-11-10T08:27:17Z</published>
	<updated>2009-11-10T08:27:17Z</updated>
	<author>
		<name>Daniel Fischer-4</name>
	</author>
	<content type="html">Am Dienstag 10 November 2009 14:01:33 schrieb Philippos Apolinarius:
&lt;br&gt;&amp;gt; Hi, Jason.
&lt;br&gt;&amp;gt; I don't know how to mark the call unsafe. And I don't know what is a *Nix
&lt;br&gt;&amp;gt; (perhaps unix?).
&lt;br&gt;&lt;br&gt;Unix or unix-derivate (linux, BSD, ...)
&lt;br&gt;&lt;br&gt;&amp;gt; I am running the main program on Windows.
&lt;br&gt;&lt;br&gt;Then it might be necesary to let the foreign calls have the calling convention stdcall 
&lt;br&gt;instead of ccall.
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26286543&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Help-Haskell-driving-Medical-Instruments-tp26278363p26286543.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26286059</id>
	<title>Re: is proof by testing possible?</title>
	<published>2009-11-10T08:02:51Z</published>
	<updated>2009-11-10T08:02:51Z</updated>
	<author>
		<name>Curt Sampson-2</name>
	</author>
	<content type="html">On 2009-11-10 08:24 +0000 (Tue), Conor McBride wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; On 10 Nov 2009, at 05:52, Curt Sampson wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This is sometimes described as the &amp;quot;reflective&amp;quot; proof method: express
&lt;br&gt;&amp;gt; problem in language capturing decidable fragment; hit with big stick.
&lt;br&gt;&lt;br&gt;Well, that's pretty sweet. *And* you get to use a big stick. Who can
&lt;br&gt;argue with that?
&lt;br&gt;&lt;br&gt;&amp;gt; I'm sure there's more to be found here. It smells a bit of theorems
&lt;br&gt;&amp;gt; for free: the strength comes from knowing what you don't.
&lt;br&gt;&lt;br&gt;Yup. But this seems to me to be heading towards keeping proofs with your
&lt;br&gt;code (which we're already doing in sort of a simple way with our type
&lt;br&gt;systems; how long can it be until we're embedding Coq or Agda proofs in
&lt;br&gt;our production Haskell code?). That's heading well away from testing.
&lt;br&gt;(And I approve.)
&lt;br&gt;&lt;br&gt;cjs
&lt;br&gt;-- 
&lt;br&gt;Curt Sampson &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26286059&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;cjs@...&lt;/a&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+81 90 7737 2974
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Functional programming in all senses of the word:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.starling-software.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.starling-software.com&lt;/a&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26286059&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/is-proof-by-testing-possible--tp25860155p26286059.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26282992</id>
	<title>Re: Help Haskell driving Medical Instruments</title>
	<published>2009-11-10T05:01:33Z</published>
	<updated>2009-11-10T05:01:33Z</updated>
	<author>
		<name>Philippos Apolinarius</name>
	</author>
	<content type="html">&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot;&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot; style=&quot;font: inherit;&quot;&gt;Hi, Jason.&lt;br&gt;I don't know how to mark the call unsafe. And I don't know what is a *Nix (perhaps unix?). I am running the main program on Windows.&amp;nbsp; Here is the compilation script:&lt;br&gt;&lt;br&gt;ghc -fglasgow-exts serial.c&amp;nbsp; %1.hs -L./ -ljapi --make&lt;br&gt;erase *.hi&lt;br&gt;erase *.o&lt;br&gt;strip %1.exe&lt;br&gt;&lt;br&gt;BTW I figure out that passing an argument to closecport only makes the problem occur less often. Here is an example:&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;strip
 temper.exe&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\se
nsors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;4&lt;br&gt;&lt;br&gt;D:\ghc\sensors&amp;gt;temper.exe&lt;br&gt;unable to set comport cfg settings&lt;br&gt;4&lt;br&gt;&lt;br&gt;&lt;br&gt;--- On &lt;b&gt;Mon, 11/9/09, Jason Dusek &lt;i&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26282992&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jason.dusek@...&lt;/a&gt;&amp;gt;&lt;/i&gt;&lt;/b&gt; wrote:&lt;br&gt;&lt;blockquote style=&quot;border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;&quot;&gt;&lt;br&gt;From: Jason Dusek &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26282992&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jason.dusek@...&lt;/a&gt;&amp;gt;&lt;br&gt;Subject: Re: [Haskell-cafe] Help Haskell driving Medical Instruments&lt;br&gt;To: &quot;Philippos Apolinarius&quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26282992&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;phi500ac@...&lt;/a&gt;&amp;gt;&lt;br&gt;Cc: &quot;Haskell Cafe&quot; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26282992&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;haskell-cafe@...&lt;/a&gt;&amp;gt;&lt;br&gt;Received: Monday, November 9, 2009, 11:41 PM&lt;br&gt;&lt;br&gt;&lt;div class=&quot;plainMail&quot;&gt;&amp;nbsp; Does marking the call `unsafe` make any difference?&lt;br&gt;&lt;br&gt;&amp;nbsp; This is running on a *NIX of some flavour?&lt;br&gt;&lt;br&gt;--&lt;br&gt;Jason Dusek&lt;br&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;
      &lt;hr size=1&gt;Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the &lt;a href=&quot;http://ca.promos.yahoo.com/newmail/overview2/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;&lt;b&gt;All-new Yahoo! Mail &lt;/b&gt;&lt;/a&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26282992&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Help-Haskell-driving-Medical-Instruments-tp26278363p26282992.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26282390</id>
	<title>Type-indexed expressions with fixpoint</title>
	<published>2009-11-10T04:12:27Z</published>
	<updated>2009-11-10T04:12:27Z</updated>
	<author>
		<name>oleg-30</name>
	</author>
	<content type="html">&lt;br&gt;Brent Yorgey wrote:
&lt;br&gt;&amp;gt; This email is literate Haskell. &amp;nbsp;I'm struggling to come up with the
&lt;br&gt;&amp;gt; right way to add a fixpoint constructor to an expression language
&lt;br&gt;&amp;gt; described by a type-indexed GADT (details below).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; but since Haskell doesn't have type-level lambdas, I don't see how
&lt;br&gt;&amp;gt; to make that work.
&lt;br&gt;&lt;br&gt;John Reynolds showed long ago that any higher-order language can be
&lt;br&gt;encoded in first-order. We witness this every day: higher-order
&lt;br&gt;language like Haskell is encoded in first-order language (machine
&lt;br&gt;code). The trick is just to add a layer of interpretive overhead -- I
&lt;br&gt;mean, a layer of interpretation. The closure conversion on type level
&lt;br&gt;was shown in
&lt;br&gt;&amp;nbsp; &lt;a href=&quot;http://okmij.org/ftp/Computation/lambda-calc.html#haskell-type-level&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://okmij.org/ftp/Computation/lambda-calc.html#haskell-type-level&lt;/a&gt;&lt;br&gt;&lt;br&gt;Here's how a similar technique applies to the problem at hand. There is
&lt;br&gt;an alternative solution: encode higher-order functors by means of SKI
&lt;br&gt;combinators. Somehow I prefer the pointed solution.
&lt;br&gt;&lt;br&gt;The complete code follows.
&lt;br&gt;&lt;br&gt;{-# LANGUAGE TypeFamilies, KindSignatures, GADTs, FlexibleInstances #-}
&lt;br&gt;&lt;br&gt;data U &amp;nbsp;:: (* -&amp;gt; *) -&amp;gt; * where
&lt;br&gt;&amp;nbsp; Unit &amp;nbsp;:: U None
&lt;br&gt;&amp;nbsp; Var &amp;nbsp; :: U Id
&lt;br&gt;&amp;nbsp; (:+:) :: U f -&amp;gt; U g -&amp;gt; U (Sum f g)
&lt;br&gt;&amp;nbsp; (:*:) :: U f -&amp;gt; U g -&amp;gt; U (Prod f g)
&lt;br&gt;&amp;nbsp; Mu &amp;nbsp; &amp;nbsp;:: HOFunctor f =&amp;gt; f -&amp;gt; U (MU f)
&lt;br&gt;&lt;br&gt;data None a = None deriving Show
&lt;br&gt;data Id a = Id a deriving Show
&lt;br&gt;data Sum f g a = Inl (f a) | Inr (g a) deriving Show
&lt;br&gt;data Prod f g a = Prod (f a) (g a) deriving Show
&lt;br&gt;&lt;br&gt;newtype MU f a = MU (Res f (MU f) a)
&lt;br&gt;&lt;br&gt;type family Res f self :: * -&amp;gt; *
&lt;br&gt;type instance Res List self = Sum None (Prod Id self)
&lt;br&gt;&lt;br&gt;data List = List -- the code for the HO functor
&lt;br&gt;&lt;br&gt;class HOFunctor f where
&lt;br&gt;&amp;nbsp; &amp;nbsp; fn :: f -&amp;gt; U g -&amp;gt; U (Res f g)
&lt;br&gt;&lt;br&gt;instance HOFunctor List where
&lt;br&gt;&amp;nbsp; &amp;nbsp; fn _ self = Unit :+: (Var :*: self)
&lt;br&gt;&lt;br&gt;enumShapes :: Int -&amp;gt; U f -&amp;gt; [f ()]
&lt;br&gt;enumShapes 0 Unit = [None]
&lt;br&gt;enumShapes _ Unit = []
&lt;br&gt;enumShapes 1 Var &amp;nbsp;= [Id ()]
&lt;br&gt;enumShapes _ Var &amp;nbsp;= []
&lt;br&gt;enumShapes n (f :+: g) = map Inl (enumShapes n f) ++ map Inr (enumShapes n g)
&lt;br&gt;enumShapes n (f :*: g) = [ Prod x y | x &amp;lt;- enumShapes n f, y &amp;lt;- enumShapes n g]
&lt;br&gt;&lt;br&gt;enumShapes n self@(Mu f) = map MU $ enumShapes (n-1) (fn f self)
&lt;br&gt;&lt;br&gt;test0 = enumShapes 0 (Unit :+: (Var :*: Var))
&lt;br&gt;-- [Inl None]
&lt;br&gt;test1 = enumShapes 1 (Unit :+: (Var :*: Var))
&lt;br&gt;-- [Inr (Prod (Id ()) (Id ()))]
&lt;br&gt;&lt;br&gt;test2 = enumShapes 1 (Mu List)
&lt;br&gt;-- [Inl None]
&lt;br&gt;test3 = enumShapes 2 (Mu List)
&lt;br&gt;-- [Inr (Prod (Id ()) Inl None)]
&lt;br&gt;&lt;br&gt;instance Show (MU List ()) where
&lt;br&gt;&amp;nbsp; &amp;nbsp; show (MU x) = show x
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26282390&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Type-indexed-expressions-with-fixpoint-tp26282390p26282390.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26282185</id>
	<title>Re: filter using foldr point-free?</title>
	<published>2009-11-10T03:56:56Z</published>
	<updated>2009-11-10T03:56:56Z</updated>
	<author>
		<name>Svein Ove Aas</name>
	</author>
	<content type="html">On Tue, Nov 10, 2009 at 12:47 PM, damodar kulkarni
&lt;br&gt;&amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26282185&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kdamodar2000@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt; We can define filter using foldr as under:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; filter1 p = foldr (\x xs -&amp;gt; (if (p x) then (x:xs) else xs))  []
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Can we define filter using foldr but in pointfree style?
&lt;br&gt;&amp;gt;
&lt;br&gt;Pointfree code is (nearly) always possible, but sometimes not very
&lt;br&gt;desirable. The first thing to do is to ask lambdabot for help; in this
&lt;br&gt;case, the answer is.. this:
&lt;br&gt;&lt;br&gt;filter1 = &amp;nbsp;flip foldr [] . flip flip id . (ap .) . (`ap` (:)) . (((.) . if') .)
&lt;br&gt;&lt;br&gt;if' p a b = if p then a else b
&lt;br&gt;&lt;br&gt;&lt;br&gt;Now, there may be a better way to go about this, but I don't think I'd
&lt;br&gt;bother trying. The pointful variant seems quite readable as-is. :P
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Svein Ove Aas
&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26282185&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/filter-using-foldr-point-free--tp26282089p26282185.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26282089</id>
	<title>filter using foldr point-free?</title>
	<published>2009-11-10T03:47:54Z</published>
	<updated>2009-11-10T03:47:54Z</updated>
	<author>
		<name>kk08</name>
	</author>
	<content type="html">Hi,&lt;br&gt;We can define filter using foldr as under:&lt;br&gt;&lt;br&gt;filter1 p = foldr (\x xs -&amp;gt; (if (p x) then (x:xs) else xs))  []&lt;br&gt;&lt;br&gt;Can we define filter using foldr but in pointfree style?&lt;br&gt;&lt;br&gt;Thanks&lt;br&gt;-DM&lt;br&gt;
&lt;br /&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26282089&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/filter-using-foldr-point-free--tp26282089p26282089.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26281484</id>
	<title>Re: pattern match failure as control structure</title>
	<published>2009-11-10T02:50:45Z</published>
	<updated>2009-11-10T02:50:45Z</updated>
	<author>
		<name>Roel van Dijk-3</name>
	</author>
	<content type="html">Have a look at this recently uploaded package:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://hackage.haskell.org/package/first-class-patterns&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://hackage.haskell.org/package/first-class-patterns&lt;/a&gt;&lt;br&gt;&lt;br&gt;Examine the &amp;quot;tryMatch&amp;quot; function in particular.
&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26281484&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/pattern-match-failure-as-control-structure-tp26281079p26281484.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26281428</id>
	<title>Re: is proof by testing possible?</title>
	<published>2009-11-10T02:46:08Z</published>
	<updated>2009-11-10T02:46:08Z</updated>
	<author>
		<name>Heinrich Apfelmus</name>
	</author>
	<content type="html">Conor McBride wrote:
&lt;br&gt;&amp;gt; ....and you can calculate how much testing is enough by
&lt;br&gt;&amp;gt; computing an upper bound on the polynomial degree of the
&lt;br&gt;&amp;gt; expression. (The summation operator increments degree,
&lt;br&gt;&amp;gt; the difference operator decreases it, like in calculus.)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This is sometimes described
&lt;br&gt;&amp;gt; as the &amp;quot;reflective&amp;quot; proof method: express problem in
&lt;br&gt;&amp;gt; language capturing decidable fragment; hit with big stick. 
&lt;br&gt;&lt;br&gt;The fact that summation maps polynomials to polynomials needs to be
&lt;br&gt;proven, of course, and I guess that this proof is not much simpler than
&lt;br&gt;proving
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;sum . map (^3) $ [1..n] = (sum $ [1..n])^2
&lt;br&gt;&lt;br&gt;in the first place. But once proven, the former can be reused ad libitum.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;apfelmus
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;&lt;a href=&quot;http://apfelmus.nfshost.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://apfelmus.nfshost.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26281428&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/is-proof-by-testing-possible--tp25860155p26281428.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26281079</id>
	<title>pattern match failure as control structure</title>
	<published>2009-11-10T02:16:44Z</published>
	<updated>2009-11-10T02:16:44Z</updated>
	<author>
		<name>Dan Mead</name>
	</author>
	<content type="html">hey all, &amp;nbsp;is there something special about pattern match exceptions?
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;i'm attempting to catch pattern match failures to use as control for a
&lt;br&gt;production system.
&lt;br&gt;&lt;br&gt;&lt;br&gt;so i want to be able to do something like
&lt;br&gt;&lt;br&gt;catch (head []) &amp;nbsp; (\e -&amp;gt; print &amp;quot;that theres pattern fail!&amp;quot; )
&lt;br&gt;&lt;br&gt;&lt;br&gt;any suggestions?
&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26281079&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/pattern-match-failure-as-control-structure-tp26281079p26281079.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26279835</id>
	<title>Re: is proof by testing possible?</title>
	<published>2009-11-10T00:24:51Z</published>
	<updated>2009-11-10T00:24:51Z</updated>
	<author>
		<name>Conor McBride-2</name>
	</author>
	<content type="html">&lt;br&gt;On 10 Nov 2009, at 05:52, Curt Sampson wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; On 2009-11-09 14:22 -0800 (Mon), muad wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Proof: True for n = 0, 1, 2, 3, 4 (check!), hence true for all n. &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; QED.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ...
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Actually, the test is that it's true for 0 through 4 is not sufficient
&lt;br&gt;&amp;gt; for a proof;
&lt;br&gt;&lt;br&gt;It's enough testing...
&lt;br&gt;&lt;br&gt;&amp;gt; you also need to prove in some way that you need do no
&lt;br&gt;&amp;gt; further tests.
&lt;br&gt;&lt;br&gt;...and you can calculate how much testing is enough by
&lt;br&gt;computing an upper bound on the polynomial degree of the
&lt;br&gt;expression. (The summation operator increments degree,
&lt;br&gt;the difference operator decreases it, like in calculus.)
&lt;br&gt;&lt;br&gt;&amp;gt; Showing that particular point in this case appears to me
&lt;br&gt;&amp;gt; to lie outside the realm of testing.
&lt;br&gt;&lt;br&gt;You need to appeal to a general theorem about expressions
&lt;br&gt;of a particular form, but if that theorem is in the
&lt;br&gt;library, the only work you need do is to put the
&lt;br&gt;expressions in that form. This is sometimes described
&lt;br&gt;as the &amp;quot;reflective&amp;quot; proof method: express problem in
&lt;br&gt;language capturing decidable fragment; hit with big stick.
&lt;br&gt;&lt;br&gt;There are lots of other examples of this phenomenon. The
&lt;br&gt;zero-one principle for sorting networks is a favourite of
&lt;br&gt;mine. I'm sure there's more to be found here. It smells
&lt;br&gt;a bit of theorems for free: the strength comes from
&lt;br&gt;knowing what you don't.
&lt;br&gt;&lt;br&gt;All the best
&lt;br&gt;&lt;br&gt;Conor
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26279835&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/is-proof-by-testing-possible--tp25860155p26279835.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26278996</id>
	<title>Re: Help Haskell driving Medical Instruments</title>
	<published>2009-11-09T22:41:16Z</published>
	<updated>2009-11-09T22:41:16Z</updated>
	<author>
		<name>Jason Dusek</name>
	</author>
	<content type="html">&amp;nbsp; Does marking the call `unsafe` make any difference?
&lt;br&gt;&lt;br&gt;&amp;nbsp; This is running on a *NIX of some flavour?
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Jason Dusek
&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26278996&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Help-Haskell-driving-Medical-Instruments-tp26278363p26278996.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26278676</id>
	<title>Re: is proof by testing possible?</title>
	<published>2009-11-09T21:52:21Z</published>
	<updated>2009-11-09T21:52:21Z</updated>
	<author>
		<name>Curt Sampson-2</name>
	</author>
	<content type="html">On 2009-11-09 14:22 -0800 (Mon), muad wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;gt; Proof: True for n = 0, 1, 2, 3, 4 (check!), hence true for all n. QED.
&lt;br&gt;&amp;gt; &amp;gt; ...
&lt;br&gt;&lt;br&gt;Actually, the test is that it's true for 0 through 4 is not sufficient
&lt;br&gt;for a proof; you also need to prove in some way that you need do no
&lt;br&gt;further tests. Showing that particular point in this case appears to me
&lt;br&gt;to lie outside the realm of testing.
&lt;br&gt;&lt;br&gt;cjs
&lt;br&gt;-- 
&lt;br&gt;Curt Sampson &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26278676&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;cjs@...&lt;/a&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;+81 90 7737 2974
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Functional programming in all senses of the word:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.starling-software.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.starling-software.com&lt;/a&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26278676&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/is-proof-by-testing-possible--tp25860155p26278676.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26278363</id>
	<title>Help Haskell driving Medical Instruments</title>
	<published>2009-11-09T21:04:05Z</published>
	<updated>2009-11-09T21:04:05Z</updated>
	<author>
		<name>Philippos Apolinarius</name>
	</author>
	<content type="html">&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot;&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot; style=&quot;font: inherit;&quot;&gt;Recently, I received as gift medical instruments designed by one of my father former students. There is a description of these instruments on my web page. Here is the address:&lt;br&gt;&lt;br&gt;http://www.discenda.org/med/&lt;br&gt;&lt;br&gt;By the way, I am not that guy that appears in a picture wearing emg sensors. That said, the instruments and everything else are programmed in Clean. Then I have a new opportunity of translating Clean programs to Haskell and test them in a real application application. Of course, I simplified the programs to see how they work.&lt;br&gt;&lt;br&gt;The medical instruments have on-board computers, that record signals (electromyograms, electroencephalograms, electrocardiograms, end-tydal CO2 partial pressure and temperature), pre-process them and send them to the main computer. The main-computer recognizes patterns in the signals, and use the result to drive a
 wheelchair, or to call a doctor. On my page you wil find more complete explanations and pictures of the instruments. For ready reference, here is my address:&lt;br&gt;&lt;br&gt;http://www.discenda.org/med/&lt;br&gt;
&lt;br&gt;I decided start my translation work from the most simple programs, the graphical interface and the communication protocol.&amp;nbsp; After substituting a Haskell program for the Clean original, I discovered that the system did not work anymore if I exited the Haskell program. In few words, after leaving the Haskell program without turning off the computer or the sensors, and entering the Haskell program again, Haskell failed to communicate with the sensors. I did what I always do in&amp;nbsp; such a situation: I simplified the program until I reduced it to a few lines. I discovered that Haskell failed to close the serial port.&amp;nbsp; There is a serial to UART-0 driver that allows me to plug the serial cable to a USB port, that both feeds the sensors, and permit communication.&lt;br&gt;&lt;br&gt;I fixed the bug by passing a useless integer argument to the function used to close the port. Since I don't like this kind of patch (useless arguments), I would like to know why
 the original program does not work, and also I would appreciate if someone could suggest a way to get rid of the argument whose sole job is force Haskell to close the port.&amp;nbsp; The GUI is based on the Small JAPI biding, fixed and incremented with text processing components. Here is the fixed Haskell program:&lt;br&gt;&lt;br&gt;import Gui.Binding&lt;br&gt;import Gui.Types&lt;br&gt;import Gui.Constants&lt;br&gt;import SER.IAL&lt;br&gt;import Control.Monad&lt;br&gt;import Data.Char&lt;br&gt;&lt;br&gt;main = do rv &amp;lt;- j_start&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; frame &amp;lt;- j_frame &quot;Sensors&quot;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; exit_button &amp;lt;- j_button frame &quot;Exit&quot;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; j_setpos exit_button 50 50&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; j_setsize exit_button 80 30&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; fld &amp;lt;- j_textfield frame 30 &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; j_setpos fld 50 100&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; j_show
 frame&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; opencport(4)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; waitForFrameAction frame fld exit_button&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; let r = closecport 7&amp;nbsp; {- without the argument, closecport does not work -}&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print r&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return j_quit&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&lt;br&gt;waitForFrameAction :: Frame -&amp;gt;&amp;nbsp; Object -&amp;gt; Object -&amp;gt; IO Bool&lt;br&gt;waitForFrameAction frame f b = &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do obj &amp;lt;-&amp;nbsp; j_nextaction&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; again &amp;lt;- if obj == event b&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then return False&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else
 &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do {- nm &amp;lt;- j_gettext f 200 -}&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tx &amp;lt;- sendMessage 1 &quot;t&quot;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; let tp= filter (&amp;gt; ' ') tx&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rx &amp;lt;- sendMessage 1 &quot;x&quot;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; let rd= filter (&amp;gt; ' ') rx&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; let x = hex2dec rd&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; let tt= (fromIntegral x)*209.0/1024 - 67.5&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
 j_settext f ((show tt)++&quot; ==&amp;gt; &quot;++tp)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return True&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not again&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; then return True&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; else waitForFrameAction frame f&amp;nbsp; b&lt;br&gt;&lt;br&gt;hex2dec :: String -&amp;gt; Int&lt;br&gt;hex2dec h= sum (zipWith (*) &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (map (16^) [3,2,1,0])&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [digitToInt c | c &amp;lt;- h]) &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;convert d r s0= (fromIntegral (hex2dec d))*r/1024.0- s0 &lt;br&gt;&lt;br&gt;&lt;br&gt;As I told before, let r = closecport 7&amp;nbsp; did not work until I gave it an argument. Here is the
 interface between the C-side, and the Haskell-side of the program:&lt;br&gt;&lt;br&gt;{-# LANGUAGE ForeignFunctionInterface #-}&lt;br&gt;module SER.IAL where&lt;br&gt;&amp;nbsp;&lt;br&gt;&amp;nbsp;import Control.Monad&lt;br&gt;&amp;nbsp;import Foreign&lt;br&gt;&lt;br&gt;&amp;nbsp;import Foreign.C.Types&lt;br&gt;&amp;nbsp;import Foreign.C &lt;br&gt;&lt;br&gt;&amp;nbsp;foreign import ccall &quot;rs232.h opencport&quot; opencport :: CInt -&amp;gt; IO ()&lt;br&gt;&amp;nbsp;foreign import ccall &quot;rs232.h closecport&quot; closecport :: CInt -&amp;gt; CInt&lt;br&gt;&lt;br&gt;&amp;nbsp;foreign import ccall &quot;rs232.h rdrs232&quot; c_sendmsg :: CInt -&amp;gt; CString -&amp;gt; CString&lt;br&gt;&amp;nbsp;sendMessage :: Int -&amp;gt; String -&amp;gt; IO String&lt;br&gt;&amp;nbsp;sendMessage&amp;nbsp; n msg = &lt;br&gt;&amp;nbsp;&amp;nbsp; withCString msg $&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; \str -&amp;gt; peekCString (c_sendmsg (fromIntegral n) str)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br&gt;&lt;br&gt;Originally, I had the following line (that did not work properly):&lt;br&gt;&lt;br&gt;foreign import ccall &quot;rs232.h closecport&quot; closecport ::&amp;nbsp; IO ()&lt;br&gt;&lt;br&gt;&lt;br&gt;You will find below the
 C-program. The original program (that did not work) had the following definition for closecport:&lt;br&gt;&lt;br&gt;int closecport() {&lt;br&gt;&amp;nbsp;&amp;nbsp; CloseComport();&lt;br&gt;&amp;nbsp;&amp;nbsp; return 3; }&lt;br&gt;&lt;br&gt;This deffinition (that did not work) was replaced by the following one:&lt;br&gt;&lt;br&gt;int closecport(int n) {&lt;br&gt;&amp;nbsp;&amp;nbsp; CloseComport();&lt;br&gt;&amp;nbsp;&amp;nbsp; return n; }&lt;br&gt;&lt;br&gt;Here is the complete C program:&lt;br&gt;&lt;br&gt;#include &quot;serial.h&quot;&lt;br&gt;#include &amp;lt;string.h&amp;gt;&lt;br&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br&gt;&lt;br&gt;/*&lt;br&gt;Possible baudrates on a normal pc:&lt;br&gt;&lt;br&gt;50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800,&lt;br&gt;2400, 4800, 9600, 19200, 38400, 57600, 115200&lt;br&gt;*/&lt;br&gt;&lt;br&gt;#define BAUD &quot;baud=9600 data=8 parity=N stop=1&quot;&lt;br&gt;&lt;br&gt;&lt;br&gt;HANDLE Cport;&lt;br&gt;&lt;br&gt;&lt;br&gt;char comports[16][10]={&quot;\\\\.\\COM1&quot;,&amp;nbsp; &quot;\\\\.\\COM2&quot;,&amp;nbsp; &quot;\\\\.\\COM3&quot;,&amp;nbsp; &quot;\\\\.\\COM4&quot;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
 &quot;\\\\.\\COM5&quot;,&amp;nbsp; &quot;\\\\.\\COM6&quot;,&amp;nbsp; &quot;\\\\.\\COM7&quot;,&amp;nbsp; &quot;\\\\.\\COM8&quot;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;\\\\.\\COM9&quot;,&amp;nbsp; &quot;\\\\.\\COM10&quot;, &quot;\\\\.\\COM11&quot;, &quot;\\\\.\\COM12&quot;,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;\\\\.\\COM13&quot;, &quot;\\\\.\\COM14&quot;, &quot;\\\\.\\COM15&quot;, &quot;\\\\.\\COM16&quot;};&lt;br&gt;&lt;br&gt;&lt;br&gt;int OpenComport(int comport_number)&lt;br&gt;{&lt;br&gt;&amp;nbsp; if(comport_number&amp;gt;15)&lt;br&gt;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;illegal comport number\n&quot;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(1);&lt;br&gt;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp; Cport = CreateFileA(comports[comport_number],&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
 GENERIC_READ|GENERIC_WRITE,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* no share&amp;nbsp; */&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NULL,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* no security */&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OPEN_EXISTING,&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
 0,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* no threads */&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NULL);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* no templates */&lt;br&gt;&lt;br&gt;&amp;nbsp; if(Cport==INVALID_HANDLE_VALUE)&lt;br&gt;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;unable to open comport\n&quot;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(1);&lt;br&gt;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp; DCB port_settings;&lt;br&gt;&amp;nbsp; memset(&amp;amp;port_settings, 0, sizeof(port_settings));&amp;nbsp; /* clear the new struct&amp;nbsp; */&lt;br&gt;&amp;nbsp; port_settings.DCBlength = sizeof(port_settings);&lt;br&gt;&lt;br&gt;&amp;nbsp; if(!BuildCommDCBA(BAUD, &amp;amp;port_settings))&lt;br&gt;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;unable to set comport dcb
 settings\n&quot;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CloseHandle(Cport);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(1);&lt;br&gt;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp; if(!SetCommState(Cport, &amp;amp;port_settings))&lt;br&gt;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;unable to set comport cfg settings\n&quot;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CloseHandle(Cport);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(1);&lt;br&gt;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp; COMMTIMEOUTS Cptimeouts;&lt;br&gt;&lt;br&gt;&amp;nbsp; Cptimeouts.ReadIntervalTimeout&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = MAXDWORD;&lt;br&gt;&amp;nbsp; Cptimeouts.ReadTotalTimeoutMultiplier&amp;nbsp; = 10;&lt;br&gt;&amp;nbsp; Cptimeouts.ReadTotalTimeoutConstant&amp;nbsp;&amp;nbsp;&amp;nbsp; = 10;&lt;br&gt;&amp;nbsp; Cptimeouts.WriteTotalTimeoutMultiplier = 10;&lt;br&gt;&amp;nbsp; Cptimeouts.WriteTotalTimeoutConstant&amp;nbsp;&amp;nbsp; = 10;&lt;br&gt;&lt;br&gt;&amp;nbsp; if(!SetCommTimeouts(Cport, &amp;amp;Cptimeouts))&lt;br&gt;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf(&quot;unable to set comport time-out settings\n&quot;);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CloseHandle(Cport);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(1);&lt;br&gt;&amp;nbsp;
 }&lt;br&gt;&lt;br&gt;&amp;nbsp; return(0);&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;int PollComport(unsigned char *buf, int size)&lt;br&gt;{&lt;br&gt;&amp;nbsp; int n;&lt;br&gt;&lt;br&gt;&amp;nbsp; if(size&amp;gt;4096)&amp;nbsp; size = 4096;&lt;br&gt;&lt;br&gt;/* added the void pointer cast, otherwise gcc will complain about */&lt;br&gt;/* &quot;warning: dereferencing type-punned pointer will break strict aliasing rules&quot; */&lt;br&gt;&lt;br&gt;&amp;nbsp; ReadFile(Cport, buf, size, (LPDWORD)((void *)&amp;amp;n), NULL);&lt;br&gt;&lt;br&gt;&amp;nbsp; return(n);&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;int RdByte(unsigned char* m)&lt;br&gt;{&lt;br&gt;&amp;nbsp; int n;&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp; ReadFile(Cport, m, 1, (LPDWORD)((void *)&amp;amp;n), NULL);&lt;br&gt;&lt;br&gt;&amp;nbsp; return(n);&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;int SendByte(unsigned char byte)&lt;br&gt;{&lt;br&gt;&amp;nbsp; int n;&lt;br&gt;&lt;br&gt;&amp;nbsp; WriteFile(Cport, &amp;amp;byte, 1, (LPDWORD)((void *)&amp;amp;n), NULL);&lt;br&gt;&lt;br&gt;&amp;nbsp; if(n&amp;lt;0)&amp;nbsp; return(1);&lt;br&gt;&lt;br&gt;&amp;nbsp; return(0);&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;int SendBuf(unsigned char *buf, int size)&lt;br&gt;{&lt;br&gt;&amp;nbsp; int n;&lt;br&gt;&lt;br&gt;&amp;nbsp; if(WriteFile(Cport, buf, size, (LPDWORD)((void *)&amp;amp;n),
 NULL))&lt;br&gt;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(n);&lt;br&gt;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp; return(-1);&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;int CloseComport(void)&lt;br&gt;{&lt;br&gt;&amp;nbsp; CloseHandle(Cport);&lt;br&gt;&amp;nbsp; return(0);&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;int IsCTSEnabled(void)&lt;br&gt;{&lt;br&gt;&amp;nbsp; int status;&lt;br&gt;&lt;br&gt;&amp;nbsp; GetCommModemStatus(Cport, (LPDWORD)((void *)&amp;amp;status));&lt;br&gt;&lt;br&gt;&amp;nbsp; if(status&amp;amp;MS_CTS_ON) return(1);&lt;br&gt;&amp;nbsp; else return(0);&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;int cprintf(const char *text)&amp;nbsp; /* sends a string to serial port */&lt;br&gt;{&lt;br&gt;&amp;nbsp; while(*text != 0)&amp;nbsp;&amp;nbsp; SendByte(*(text++));&lt;br&gt;&amp;nbsp; return(0);&lt;br&gt;}&lt;br&gt;&lt;br&gt;int opencport(int p) {&lt;br&gt;&amp;nbsp;&amp;nbsp; OpenComport(p-1);&lt;br&gt;&amp;nbsp;&amp;nbsp; return 3;&lt;br&gt;&lt;br&gt;}&lt;br&gt;&lt;br&gt;int closecport(int n) {&lt;br&gt;&amp;nbsp;&amp;nbsp; CloseComport();&lt;br&gt;&amp;nbsp;&amp;nbsp; return n;&lt;br&gt;&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;char* rdrs232(int n, char* msg) {&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; char *str;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; char mm;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int i, j;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for
 (j=0; j&amp;lt;n; j++) {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; SendByte(msg[j]); }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; str = (char *) malloc(16000);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=0;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mm=0;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while (mm != 10) {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; RdByte(&amp;amp;mm);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; str[i]= mm;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; i= i+1;&lt;br&gt;&lt;br&gt;}&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (i&amp;gt;0 &amp;amp;&amp;amp; str[0]==0) { str[0]= ' ';}&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return(str);&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;Finally, here is the serial.h file:&lt;br&gt;&lt;br&gt;#ifndef rs232_INCLUDED&lt;br&gt;#define rs232_INCLUDED&lt;br&gt;&lt;br&gt;#ifdef __cplusplus&lt;br&gt;extern &quot;C&quot; {&lt;br&gt;#endif&lt;br&gt;&lt;br&gt;#include &amp;lt;stdio.h&amp;gt;&lt;br&gt;#include &amp;lt;string.h&amp;gt;&lt;br&gt;&lt;br&gt;#ifdef __linux__&lt;br&gt;&lt;br&gt;#include &amp;lt;termios.h&amp;gt;&lt;br&gt;#include &amp;lt;sys/ioctl.h&amp;gt;&lt;br&gt;#include &amp;lt;unistd.h&amp;gt;&lt;br&gt;#include &amp;lt;fcntl.h&amp;gt;&lt;br&gt;#include &amp;lt;sys/types.h&amp;gt;&lt;br&gt;#include &amp;lt;sys/stat.h&amp;gt;&lt;br&gt;#include
 &amp;lt;limits.h&amp;gt;&lt;br&gt;&lt;br&gt;#else&lt;br&gt;&lt;br&gt;#include &amp;lt;windows.h&amp;gt;&lt;br&gt;&lt;br&gt;#endif&lt;br&gt;&lt;br&gt;int OpenComport(int);&lt;br&gt;int PollComport(unsigned char *, int);&lt;br&gt;int SendByte(unsigned char);&lt;br&gt;int SendBuf(unsigned char *, int);&lt;br&gt;int CloseComport(void);&lt;br&gt;int cprintf(const char *);&lt;br&gt;int IsCTSEnabled(void);&lt;br&gt;char *topa(int n);&lt;br&gt;int opencport(int p);&lt;br&gt;int closecport(int n);&lt;br&gt;char* rdrs232(int n, char* msg);&lt;br&gt;&lt;br&gt;#ifdef __cplusplus&lt;br&gt;} /* extern &quot;C&quot; */&lt;br&gt;#endif&lt;br&gt;&lt;br&gt;#endif&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;
      &lt;hr size=1&gt;Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the &lt;a href=&quot;http://ca.promos.yahoo.com/newmail/overview2/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;&lt;b&gt;All-new Yahoo! Mail &lt;/b&gt;&lt;/a&gt;&lt;br /&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26278363&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Help-Haskell-driving-Medical-Instruments-tp26278363p26278363.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26278273</id>
	<title>Re: ANN: acme-dont</title>
	<published>2009-11-09T20:48:41Z</published>
	<updated>2009-11-09T20:48:41Z</updated>
	<author>
		<name>Richard O'Keefe</name>
	</author>
	<content type="html">&lt;br&gt;On Nov 9, 2009, at 11:27 PM, Gracjan Polak wrote:
&lt;br&gt;&amp;gt; With special apologies to Luke Palmer that it took the Haskell
&lt;br&gt;&amp;gt; community 7.5 years to catch up with Perl.
&lt;br&gt;&lt;br&gt;We may not have had the simple name &amp;quot;don't&amp;quot;,
&lt;br&gt;but we've been able to write &amp;quot;const $ return ()&amp;quot; for a long time.
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26278273&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/ANN%3A-acme-dont-tp26264080p26278273.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26275652</id>
	<title>Exciting job opportunity</title>
	<published>2009-11-09T15:28:17Z</published>
	<updated>2009-11-09T15:28:17Z</updated>
	<author>
		<name>siki</name>
	</author>
	<content type="html">Principal investment firm based in Manhattan is looking for an outstanding software developer to maintain and develop proprietary accounting and portfolio management systems. &amp;nbsp;
&lt;br&gt;&lt;br&gt;You should have at least a bachelor’s degree in computer science from a top university and impeccable coding style. This is a high-impact, high-visibility job opportunity where successful candidates will be entrusted with a lot of responsibility for products that have a direct effect on the P&amp;L of the firm and influences our workflow. 
&lt;br&gt;&lt;br&gt;This is a very small hedge fund with me being the only developer right now. The next hire will have a very direct say into how this side of our business progresses from here. We are a growth oriented firm that values people who take a craftsman’s pride in their work. We always like to take a contrarian view of things and value experimenting and using often overlooked technologies. That is one of the main reasons why we currently started using Haskell in developing our quantitative models. &amp;nbsp;We are looking for a canditate who shows strong analytical, organizational, and communication skills. Attention to detail is essential, i.e. we fully document everything we do and pay a lot of attention to coding style.
&lt;br&gt;&lt;br&gt;The majority of our existing code was written in Java, so candidates must have at least some experience with Java and related technologies. &amp;nbsp;Experience working with SQL would be desired as well. Background in accounting is not necessary but is definitely a
&lt;br&gt;plus.
&lt;br&gt;&lt;br&gt;Please send your CV and cover letter to recruitment at karamaan.com, or reply to this post if you have any questions.
&lt;br&gt;&lt;br&gt;Thanks
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Exciting-job-opportunity-tp26275652p26275652.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26275421</id>
	<title>Type-indexed expressions with fixpoint</title>
	<published>2009-11-09T15:09:21Z</published>
	<updated>2009-11-09T15:09:21Z</updated>
	<author>
		<name>Brent Yorgey-2</name>
	</author>
	<content type="html">Hi all,
&lt;br&gt;&lt;br&gt;This email is literate Haskell. &amp;nbsp;I'm struggling to come up with the
&lt;br&gt;right way to add a fixpoint constructor to an expression language
&lt;br&gt;described by a type-indexed GADT (details below). &amp;nbsp;Any suggestions,
&lt;br&gt;comments, or pointers welcome.
&lt;br&gt;&lt;br&gt;&amp;gt; {-# LANGUAGE KindSignatures, GADTs #-}
&lt;br&gt;&lt;br&gt;Consider the following type-indexed GADT, which encodes descriptions
&lt;br&gt;of polymorphic regular types:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; data U &amp;nbsp;:: (* -&amp;gt; *) -&amp;gt; * where
&lt;br&gt;&amp;gt; &amp;nbsp; Unit &amp;nbsp;:: U None
&lt;br&gt;&amp;gt; &amp;nbsp; Var &amp;nbsp; :: U Id
&lt;br&gt;&amp;gt; &amp;nbsp; (:+:) :: U f -&amp;gt; U g -&amp;gt; U (Sum f g)
&lt;br&gt;&amp;gt; &amp;nbsp; (:*:) :: U f -&amp;gt; U g -&amp;gt; U (Prod f g)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; data None a = None
&lt;br&gt;&amp;gt; data Id a = Id a
&lt;br&gt;&amp;gt; data Sum f g a = Inl (f a) | Inr (g a)
&lt;br&gt;&amp;gt; data Prod f g a = Prod (f a) (g a)
&lt;/div&gt;&lt;br&gt;Given u :: U f, thanks to the type indexing, we can write the
&lt;br&gt;following function to enumerate all the shapes of a given size
&lt;br&gt;described by u:
&lt;br&gt;&lt;br&gt;&amp;gt; enumShapes :: Int -&amp;gt; U f -&amp;gt; [f ()]
&lt;br&gt;&amp;gt; enumShapes 0 Unit = [None]
&lt;br&gt;&amp;gt; enumShapes _ Unit = []
&lt;br&gt;&amp;gt; enumShapes 1 Var &amp;nbsp;= [Id ()]
&lt;br&gt;&amp;gt; enumShapes _ Var &amp;nbsp;= []
&lt;br&gt;&amp;gt; enumShapes n (f :+: g) = map Inl (enumShapes n f) ++ map Inr (enumShapes n g)
&lt;br&gt;&amp;gt; enumShapes n (f :*: g) = [ Prod x y | x &amp;lt;- enumShapes n f, y &amp;lt;- enumShapes n g ]
&lt;br&gt;&lt;br&gt;But of course this isn't very interesting without adding a least
&lt;br&gt;fixpoint constructor. &amp;nbsp;That is, I'd like to have something like
&lt;br&gt;&lt;br&gt;&amp;nbsp; data U &amp;nbsp;:: (* -&amp;gt; *) -&amp;gt; * where
&lt;br&gt;&amp;nbsp; &amp;nbsp; Unit &amp;nbsp;:: U None
&lt;br&gt;&amp;nbsp; &amp;nbsp; Var &amp;nbsp; :: U Id
&lt;br&gt;&amp;nbsp; &amp;nbsp; (:+:) :: U f -&amp;gt; U g -&amp;gt; U (Sum f g)
&lt;br&gt;&amp;nbsp; &amp;nbsp; (:*:) :: U f -&amp;gt; U g -&amp;gt; U (Prod f g)
&lt;br&gt;&amp;nbsp; &amp;nbsp; Mu &amp;nbsp; &amp;nbsp;:: ???
&lt;br&gt;&lt;br&gt;&amp;nbsp; enumShapes n (Mu ...) = ...
&lt;br&gt;&lt;br&gt;But I am quite at a loss as far as expressing the type of Mu. &amp;nbsp;If the
&lt;br&gt;GADT wasn't type-indexed, I'd just use HOAS, i.e. &amp;nbsp;Mu :: (U -&amp;gt; U) -&amp;gt;
&lt;br&gt;U; but since Haskell doesn't have type-level lambdas, I don't see how
&lt;br&gt;to make that work.
&lt;br&gt;&lt;br&gt;Suggestions greatly appreciated! &amp;nbsp;Pointing out that I am looking at
&lt;br&gt;this in the wrong way (if you think such is the case) would be highly
&lt;br&gt;appreciated as well.
&lt;br&gt;&lt;br&gt;thanks,
&lt;br&gt;-Brent
&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26275421&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Type-indexed-expressions-with-fixpoint-tp26275421p26275421.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26275418</id>
	<title>Re: Observer pattern in Haskell?</title>
	<published>2009-11-09T15:08:45Z</published>
	<updated>2009-11-09T15:08:45Z</updated>
	<author>
		<name>Tom Lokhorst</name>
	</author>
	<content type="html">I haven't looked at the code extensively, I just wanted to comment on
&lt;br&gt;this point:
&lt;br&gt;&lt;br&gt;&amp;gt; There is no way to remove an observer, which is something I'd expect to have
&lt;br&gt;&amp;gt; available. &amp;nbsp;I realise this would require assigning a key to each observer
&lt;br&gt;&amp;gt; (and thus perhaps storing them in an associative map) or some way to filter
&lt;br&gt;&amp;gt; them, but I think if you can only ever add observers, it will get awkward.
&lt;br&gt;&lt;br&gt;It might be convenient to have the `addObserver` function return a
&lt;br&gt;&amp;quot;detachment function&amp;quot; as its result.
&lt;br&gt;&lt;br&gt;At Microsoft, Erik Meijer is working on an &amp;quot;Rx framework&amp;quot; [1], which
&lt;br&gt;is an implementation of the GoF Observer pattern. The implementation
&lt;br&gt;is, as Erik describes it, the mathematical dual of the Enumerable
&lt;br&gt;pattern.
&lt;br&gt;&lt;br&gt;In the Rx framework, the `addObserver` method returns an `IDisposable`
&lt;br&gt;object with a single method `dispose()`, this will detach the observer
&lt;br&gt;from its subject. This is more convenient than trying to remember the
&lt;br&gt;unique object identity of the observer (as that disallows anonymous
&lt;br&gt;lambdas).
&lt;br&gt;&lt;br&gt;I don't know how this would work in a Haskell context, but it might be
&lt;br&gt;interesting to think about.
&lt;br&gt;&lt;br&gt;&lt;br&gt;- Tom Lokhorst
&lt;br&gt;&lt;br&gt;[1]: &lt;a href=&quot;http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Brian-Beckman-and-Erik-Meijer-Inside-the-NET-Reactive-Framework-Rx/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Brian-Beckman-and-Erik-Meijer-Inside-the-NET-Reactive-Framework-Rx/&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;On Mon, Nov 9, 2009 at 3:50 PM, Neil Brown &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26275418&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;nccb2@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Andy Gimblett wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Hi all,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I've been doing some GUI programming recently, using wx.  To help manage
&lt;br&gt;&amp;gt;&amp;gt; dependencies between state and UI elements, I looked for a Haskell version
&lt;br&gt;&amp;gt;&amp;gt; of the Observer design pattern, and I found an implementation written by
&lt;br&gt;&amp;gt;&amp;gt; Bastiaan Heeren of ou.nl [1].
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Now, before I make a hackage release:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; 1. Does anyone have any comments, on either version?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; There is no way to remove an observer, which is something I'd expect to have
&lt;br&gt;&amp;gt; available.  I realise this would require assigning a key to each observer
&lt;br&gt;&amp;gt; (and thus perhaps storing them in an associative map) or some way to filter
&lt;br&gt;&amp;gt; them, but I think if you can only ever add observers, it will get awkward.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; 2. In particular, is the MVar version sensible?  I'm aiming for mutual
&lt;br&gt;&amp;gt;&amp;gt; exclusion between threads.  I _think_ I've got it, but I'm perhaps not
&lt;br&gt;&amp;gt;&amp;gt; familiar enough with the semantics of MVar to be certain.  Advice
&lt;br&gt;&amp;gt;&amp;gt; appreciated.  If it _is_ sensible, then is there any reason not to just use
&lt;br&gt;&amp;gt;&amp;gt; this, and discard the IORef version?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; It looks fine (and thread-safe) to me, but I'd agree that you may as well
&lt;br&gt;&amp;gt; just use the MVar version and leave out the IORef version.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; The current implementation is synchronous, in that any observer functions
&lt;br&gt;&amp;gt;&amp;gt; are called immediately and synchronously (and in the same thread as the
&lt;br&gt;&amp;gt;&amp;gt; change of subject value).  I'm pondering extending the package with an
&lt;br&gt;&amp;gt;&amp;gt; asynchronous version where the update just trips a flag, and the observer
&lt;br&gt;&amp;gt;&amp;gt; function picks this up later - possibly in another thread.  The idea there
&lt;br&gt;&amp;gt;&amp;gt; is to help in cases where certain operations have to be in a particular
&lt;br&gt;&amp;gt;&amp;gt; thread.  But this will mean a change to the typeclass too, I guess - or the
&lt;br&gt;&amp;gt;&amp;gt; addition of another one for observers themselves.  Again, any thoughts?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I was a bit surprised at first that the observers were called synchronously.
&lt;br&gt;&amp;gt;  Asynchronous is what I'd expect, and it's also harder to code the
&lt;br&gt;&amp;gt; asynchronous handlers wrongly.  One blocking call (such as putMVar) in a
&lt;br&gt;&amp;gt; synchronous handler can screw up your whole program by delaying the
&lt;br&gt;&amp;gt; subsequent observers (and at that stage, the order in which the observers
&lt;br&gt;&amp;gt; were added begins to matter).  But my idea of how asynchronous would be
&lt;br&gt;&amp;gt; implemented seems different to yours, judging by your description.  Why not
&lt;br&gt;&amp;gt; just augment this function in the synchronous version:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; notifyObservers :: Subject sub val =&amp;gt; sub -&amp;gt; IO ()
&lt;br&gt;&amp;gt; notifyObservers subject =
&lt;br&gt;&amp;gt;  do value &amp;lt;- getValue subject
&lt;br&gt;&amp;gt;     observers &amp;lt;- getObservers subject
&lt;br&gt;&amp;gt;     mapM_ ($ value) observers to become:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; notifyObserversAsync :: Subject sub val =&amp;gt; sub -&amp;gt; IO ()
&lt;br&gt;&amp;gt; notifyObserversAsync subject =
&lt;br&gt;&amp;gt;  do value &amp;lt;- getValue subject
&lt;br&gt;&amp;gt;     observers &amp;lt;- getObservers subject
&lt;br&gt;&amp;gt;     mapM_ (forkIO . ($ value)) observers
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This is what I was expecting to happen -- all the observer actions are
&lt;br&gt;&amp;gt; spawned off into their own thread to run whatever code they want (either
&lt;br&gt;&amp;gt; communicating back to an existing thread, or performing some long in-depth
&lt;br&gt;&amp;gt; action).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Neil.
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Haskell-Cafe mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26275418&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;/div&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26275418&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Observer-pattern-in-Haskell--tp26267269p26275418.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26274795</id>
	<title>Re: Cabal</title>
	<published>2009-11-09T14:23:35Z</published>
	<updated>2009-11-09T14:23:35Z</updated>
	<author>
		<name>Duncan Coutts-4</name>
	</author>
	<content type="html">On Mon, 2009-11-09 at 17:40 +0000, Stephen Tetley wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; 2009/11/9 Duncan Coutts &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26274795&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;duncan.coutts@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; That should work, and probably the recommendation should be for cygwin
&lt;br&gt;&amp;gt; &amp;gt; users to edit their cabal config to at add C:\cygwin\lib and C:\cygwin
&lt;br&gt;&amp;gt; &amp;gt; \usr\include as standard.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Hi Duncan
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; That would definitely be the best idea, but where does the cabal
&lt;br&gt;&amp;gt; config live?
&lt;/div&gt;&lt;br&gt;If you were running the current version then &amp;quot;cabal --help&amp;quot; would say.
&lt;br&gt;&lt;br&gt;To upgrade run:
&lt;br&gt;&lt;br&gt;cabal install cabal-install
&lt;br&gt;&lt;br&gt;Otherwise, it's somewhere like
&lt;br&gt;C:\Documents and Settings\$user\Application Data\cabal\config
&lt;br&gt;&lt;br&gt;though on some systems (vista perhaps?) I think it's under the user's
&lt;br&gt;roaming profile directory.
&lt;br&gt;&lt;br&gt;Duncan
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26274795&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Cabal-tp26260794p26274795.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26274773</id>
	<title>Re: is proof by testing possible?</title>
	<published>2009-11-09T14:22:00Z</published>
	<updated>2009-11-09T14:22:00Z</updated>
	<author>
		<name>muad</name>
	</author>
	<content type="html">I have come across an example:
&lt;br&gt;&lt;br&gt;&amp;gt; However, the following proof of the lovely identity:
&lt;br&gt;&amp;gt; sum . map (^3) $ [1..n] = (sum $ [1..n])^2 &amp;nbsp;is perfectly rigorous. 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Proof: True for n = 0, 1, 2, 3, 4 (check!), hence true for all n. QED.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; In order to turn this into a full-ﬂedged proof, all you have to do is mumble the following incantation:
&lt;br&gt;&amp;gt; Both sides are polynomials of degree ≤ 4, hence it is enough to check the identity at ﬁve distinct
&lt;br&gt;&amp;gt; values. 
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;from &lt;a href=&quot;http://www.math.rutgers.edu/~zeilberg/mamarim/mamarimPDF/enquiry.pdf&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.math.rutgers.edu/~zeilberg/mamarim/mamarimPDF/enquiry.pdf&lt;/a&gt;&lt;br&gt;&lt;br&gt;Now this sort of idea surely applies to more than just number theory?</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/is-proof-by-testing-possible--tp25860155p26274773.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26274680</id>
	<title>Re: classes question</title>
	<published>2009-11-09T14:13:30Z</published>
	<updated>2009-11-09T14:13:30Z</updated>
	<author>
		<name>Ross Mellgren</name>
	</author>
	<content type="html">It's not your class definition that is the problem -- your class &amp;nbsp;
&lt;br&gt;definition is good.
&lt;br&gt;&lt;br&gt;The problem is that when you interact with it using the REPL, you &amp;nbsp;
&lt;br&gt;don't specify any particular type you want so it's ambiguous. Usually &amp;nbsp;
&lt;br&gt;this is not a problem in actual programs that you compile because &amp;nbsp;
&lt;br&gt;there's enough context for the type inferencer to figure out what type &amp;nbsp;
&lt;br&gt;'a' should be.
&lt;br&gt;&lt;br&gt;You can give it enough context in the REPL either by annotating the &amp;nbsp;
&lt;br&gt;value or by using some other typed thing, e.g.
&lt;br&gt;&lt;br&gt;let a = 1:: Int
&lt;br&gt;&lt;br&gt;If you really want it to only work on Int, then you shouldn't use a &amp;nbsp;
&lt;br&gt;typeclass, instead just write the function directly --
&lt;br&gt;&lt;br&gt;plus :: Int -&amp;gt; Int -&amp;gt; Int
&lt;br&gt;plus = (+)
&lt;br&gt;&lt;br&gt;-Ross
&lt;br&gt;&lt;br&gt;On Nov 9, 2009, at 5:09 PM, Paul Tokarev wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks, that works. But how sould I change my class definition, so &amp;nbsp;
&lt;br&gt;&amp;gt; that it
&lt;br&gt;&amp;gt; works without (2::Int), but just with 2?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Ross Mellgren wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; You did not specify what type of number it is -- in Haskell numeric
&lt;br&gt;&amp;gt;&amp;gt; constants like &amp;quot;1&amp;quot; are actually typed as forall a. Num a -- that is,
&lt;br&gt;&amp;gt;&amp;gt; can be any type of Num.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Try: plus (2::Int) 3
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; -Ross
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Nov 9, 2009, at 1:44 PM, Paul Tokarev wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Hi.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; I am using Hugs 98
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; I have that piece of code:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; class PlusTimes a where
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp;plus :: a -&amp;gt; a -&amp;gt; a
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; instance PlusTimes Int where
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp;plus x y = x + y
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; when I run : &amp;quot;plus 2 3&amp;quot; I get this error:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ERROR - Unresolved overloading
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; *** Type &amp;nbsp; &amp;nbsp; &amp;nbsp; : (Num a, PlusTimes a) =&amp;gt; a
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; *** Expression : plus 2 3
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; What am I doing wrong?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; -- 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; View this message in context:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/classes-question-tp26271257p26271257.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/classes-question-tp26271257p26271257.html&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; .
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Haskell-Cafe mailing list
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26274680&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt;&amp;gt; Haskell-Cafe mailing list
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26274680&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://old.nabble.com/classes-question-tp26271257p26274624.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/classes-question-tp26271257p26274624.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com 
&lt;br&gt;&amp;gt; .
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Haskell-Cafe mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26274680&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26274680&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/classes-question-tp26271257p26274680.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26274624</id>
	<title>Re: classes question</title>
	<published>2009-11-09T14:09:48Z</published>
	<updated>2009-11-09T14:09:48Z</updated>
	<author>
		<name>Paul Tokarev</name>
	</author>
	<content type="html">Thanks, that works. But how sould I change my class definition, so that it works without (2::Int), but just with 2?
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Ross Mellgren wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;You did not specify what type of number it is -- in Haskell numeric &amp;nbsp;
&lt;br&gt;constants like &amp;quot;1&amp;quot; are actually typed as forall a. Num a -- that is, &amp;nbsp;
&lt;br&gt;can be any type of Num.
&lt;br&gt;&lt;br&gt;Try: plus (2::Int) 3
&lt;br&gt;&lt;br&gt;-Ross
&lt;br&gt;&lt;br&gt;On Nov 9, 2009, at 1:44 PM, Paul Tokarev wrote:
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hi.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I am using Hugs 98
&lt;br&gt;&amp;gt; I have that piece of code:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; class PlusTimes a where
&lt;br&gt;&amp;gt; &amp;nbsp; plus :: a -&amp;gt; a -&amp;gt; a
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; instance PlusTimes Int where
&lt;br&gt;&amp;gt; &amp;nbsp; plus x y = x + y
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; when I run : &amp;quot;plus 2 3&amp;quot; I get this error:
&lt;br&gt;&amp;gt; ERROR - Unresolved overloading
&lt;br&gt;&amp;gt; *** Type &amp;nbsp; &amp;nbsp; &amp;nbsp; : (Num a, PlusTimes a) =&amp;gt; a
&lt;br&gt;&amp;gt; *** Expression : plus 2 3
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What am I doing wrong?
&lt;br&gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://old.nabble.com/classes-question-tp26271257p26271257.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/classes-question-tp26271257p26271257.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com 
&lt;br&gt;&amp;gt; .
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Haskell-Cafe mailing list
&lt;br&gt;&amp;gt; Haskell-Cafe@haskell.org
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;Haskell-Cafe@haskell.org
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/classes-question-tp26271257p26274624.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26274606</id>
	<title>strict mapM implementation correctness</title>
	<published>2009-11-09T14:07:28Z</published>
	<updated>2009-11-09T14:07:28Z</updated>
	<author>
		<name>Paolo Losi-2</name>
	</author>
	<content type="html">Hi all,
&lt;br&gt;&lt;br&gt;while coding recently I came across the need for
&lt;br&gt;a strict mapM (that I indicidently use for m = MaybeT IO).
&lt;br&gt;&lt;br&gt;I implementented this with the following simple code
&lt;br&gt;(it works for my use case):
&lt;br&gt;&lt;br&gt;mapM' :: Monad m =&amp;gt; (a-&amp;gt; m b) -&amp;gt; [a] -&amp;gt; m [b]
&lt;br&gt;mapM' _ [] &amp;nbsp; &amp;nbsp; = return []
&lt;br&gt;mapM' f (x:xs) = do y &amp;nbsp;&amp;lt;- f x
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ys &amp;lt;- y `seq` mapM' f xs
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return (y:ys)
&lt;br&gt;&lt;br&gt;Now a couple of questions:
&lt;br&gt;&lt;br&gt;1. is it so &amp;quot;rare&amp;quot; to need such a beast? Why there isn't anything
&lt;br&gt;&amp;nbsp; &amp;nbsp; like that in standard libraries?
&lt;br&gt;2. Is my implementation correct?
&lt;br&gt;3. I've seen that mapM is implemented in base via sequence
&lt;br&gt;&amp;nbsp; &amp;nbsp; (which is in turn based on foldr). Is that any specific
&lt;br&gt;&amp;nbsp; &amp;nbsp; reason to prefer base implementation to mine?
&lt;br&gt;&lt;br&gt;Thanks!
&lt;br&gt;Pao
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26274606&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/strict-mapM-implementation-correctness-tp26274606p26274606.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26273665</id>
	<title>Re: Cabal</title>
	<published>2009-11-09T13:04:40Z</published>
	<updated>2009-11-09T13:04:40Z</updated>
	<author>
		<name>Duncan Coutts-4</name>
	</author>
	<content type="html">On Sun, 2009-11-08 at 19:29 -0800, Philippos Apolinarius wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; D:\ghc\ghcapi&amp;gt;cabal install mkcabal
&lt;br&gt;&lt;br&gt;Note that as of cabal-install-0.8, the &amp;quot;mkcabal&amp;quot; functionality is
&lt;br&gt;integrated as &amp;quot;cabal init&amp;quot; (thanks to Brent Yorgey). This does not
&lt;br&gt;depend on less portable packages like pcre and readline (meaning it will
&lt;br&gt;work on Windows).
&lt;br&gt;&lt;br&gt;&amp;gt; Resolving dependencies...
&lt;br&gt;&amp;gt; Downloading pcre-light-0.3.1...
&lt;br&gt;&amp;gt; Configuring pcre-light-0.3.1...
&lt;br&gt;&lt;br&gt;There's no reason pcre-light needs a configure script. It should be
&lt;br&gt;removed. (It's also not used consistently, the Setup.hs is for a
&lt;br&gt;different build-type than the one specified in the .cabal file). 
&lt;br&gt;&lt;br&gt;&amp;gt; Downloading readline-1.0.1.0...
&lt;br&gt;&amp;gt; Configuring readline-1.0.1.0...
&lt;br&gt;&amp;gt; cabal: Error: some packages failed to install:
&lt;br&gt;&amp;gt; mkcabal-0.4.2 depends on readline-1.0.1.0 which failed to install.
&lt;br&gt;&amp;gt; pcre-light-0.3.1 failed during the configure step. The exception was:
&lt;br&gt;&amp;gt; exit: ExitFailure 1
&lt;br&gt;&amp;gt; readline-1.0.1.0 failed during the configure step. The exception was:
&lt;br&gt;&amp;gt; exit: ExitFailure 1
&lt;br&gt;&lt;br&gt;As of Cabal-1.8 the error is reported as:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cabal: The package has a './configure' script. This requires a
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Unix compatibility toolchain such as MinGW+MSYS or Cygwin.
&lt;br&gt;&lt;br&gt;Duncan
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26273665&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Cabal-tp26260794p26273665.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26271630</id>
	<title>Re: classes question</title>
	<published>2009-11-09T10:49:17Z</published>
	<updated>2009-11-09T10:49:17Z</updated>
	<author>
		<name>Joe Fredette</name>
	</author>
	<content type="html">Oh, crap, I'm sorry, I completely misread your post...
&lt;br&gt;&lt;br&gt;Disregard my previous message.
&lt;br&gt;&lt;br&gt;&lt;br&gt;/Joe
&lt;br&gt;&lt;br&gt;On Nov 9, 2009, at 1:44 PM, Paul Tokarev wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hi.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I am using Hugs 98
&lt;br&gt;&amp;gt; I have that piece of code:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; class PlusTimes a where
&lt;br&gt;&amp;gt; &amp;nbsp; plus :: a -&amp;gt; a -&amp;gt; a
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; instance PlusTimes Int where
&lt;br&gt;&amp;gt; &amp;nbsp; plus x y = x + y
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; when I run : &amp;quot;plus 2 3&amp;quot; I get this error:
&lt;br&gt;&amp;gt; ERROR - Unresolved overloading
&lt;br&gt;&amp;gt; *** Type &amp;nbsp; &amp;nbsp; &amp;nbsp; : (Num a, PlusTimes a) =&amp;gt; a
&lt;br&gt;&amp;gt; *** Expression : plus 2 3
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What am I doing wrong?
&lt;br&gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -- &amp;nbsp;
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://old.nabble.com/classes-question-tp26271257p26271257.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/classes-question-tp26271257p26271257.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Haskell - Haskell-Cafe mailing list archive at &amp;nbsp;
&lt;br&gt;&amp;gt; Nabble.com.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Haskell-Cafe mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26271630&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26271630&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/classes-question-tp26271257p26271630.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26271609</id>
	<title>Re: classes question</title>
	<published>2009-11-09T10:48:22Z</published>
	<updated>2009-11-09T10:48:22Z</updated>
	<author>
		<name>Joe Fredette</name>
	</author>
	<content type="html">(+) is a name that is already taken by the Num typeclass, you're &amp;nbsp;
&lt;br&gt;trying to overload it with a different class. It's equivalent to doing:
&lt;br&gt;&lt;br&gt;foo :: Int
&lt;br&gt;foo = 1
&lt;br&gt;&lt;br&gt;foo :: String
&lt;br&gt;foo = &amp;quot;abc&amp;quot;
&lt;br&gt;&lt;br&gt;&lt;br&gt;this would cause an (obvious) namespace collision. If you want to &amp;nbsp;
&lt;br&gt;redefine (+), you'll have to import a qualified prelude, by using the &amp;nbsp;
&lt;br&gt;NoImplicitPrelude
&lt;br&gt;pragma and `import qualified Prelude`.
&lt;br&gt;&lt;br&gt;A better alternative is to use a different name, `+`, `++` are both &amp;nbsp;
&lt;br&gt;taken (for normal addition and list concatenation, resp.).
&lt;br&gt;&lt;br&gt;/Joe
&lt;br&gt;&lt;br&gt;&lt;br&gt;On Nov 9, 2009, at 1:44 PM, Paul Tokarev wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hi.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I am using Hugs 98
&lt;br&gt;&amp;gt; I have that piece of code:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; class PlusTimes a where
&lt;br&gt;&amp;gt; &amp;nbsp; plus :: a -&amp;gt; a -&amp;gt; a
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; instance PlusTimes Int where
&lt;br&gt;&amp;gt; &amp;nbsp; plus x y = x + y
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; when I run : &amp;quot;plus 2 3&amp;quot; I get this error:
&lt;br&gt;&amp;gt; ERROR - Unresolved overloading
&lt;br&gt;&amp;gt; *** Type &amp;nbsp; &amp;nbsp; &amp;nbsp; : (Num a, PlusTimes a) =&amp;gt; a
&lt;br&gt;&amp;gt; *** Expression : plus 2 3
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What am I doing wrong?
&lt;br&gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://old.nabble.com/classes-question-tp26271257p26271257.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/classes-question-tp26271257p26271257.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Haskell - Haskell-Cafe mailing list archive at &amp;nbsp;
&lt;br&gt;&amp;gt; Nabble.com.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Haskell-Cafe mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26271609&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26271609&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/classes-question-tp26271257p26271609.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26271604</id>
	<title>Re: classes question</title>
	<published>2009-11-09T10:47:41Z</published>
	<updated>2009-11-09T10:47:41Z</updated>
	<author>
		<name>Ross Mellgren</name>
	</author>
	<content type="html">You did not specify what type of number it is -- in Haskell numeric &amp;nbsp;
&lt;br&gt;constants like &amp;quot;1&amp;quot; are actually typed as forall a. Num a -- that is, &amp;nbsp;
&lt;br&gt;can be any type of Num.
&lt;br&gt;&lt;br&gt;Try: plus (2::Int) 3
&lt;br&gt;&lt;br&gt;-Ross
&lt;br&gt;&lt;br&gt;On Nov 9, 2009, at 1:44 PM, Paul Tokarev wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hi.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I am using Hugs 98
&lt;br&gt;&amp;gt; I have that piece of code:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; class PlusTimes a where
&lt;br&gt;&amp;gt; &amp;nbsp; plus :: a -&amp;gt; a -&amp;gt; a
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; instance PlusTimes Int where
&lt;br&gt;&amp;gt; &amp;nbsp; plus x y = x + y
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; when I run : &amp;quot;plus 2 3&amp;quot; I get this error:
&lt;br&gt;&amp;gt; ERROR - Unresolved overloading
&lt;br&gt;&amp;gt; *** Type &amp;nbsp; &amp;nbsp; &amp;nbsp; : (Num a, PlusTimes a) =&amp;gt; a
&lt;br&gt;&amp;gt; *** Expression : plus 2 3
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What am I doing wrong?
&lt;br&gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -- 
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://old.nabble.com/classes-question-tp26271257p26271257.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://old.nabble.com/classes-question-tp26271257p26271257.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com 
&lt;br&gt;&amp;gt; .
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Haskell-Cafe mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26271604&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26271604&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/classes-question-tp26271257p26271604.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26271257</id>
	<title>classes question</title>
	<published>2009-11-09T10:25:00Z</published>
	<updated>2009-11-09T10:25:00Z</updated>
	<author>
		<name>Paul Tokarev</name>
	</author>
	<content type="html">Hi.
&lt;br&gt;&lt;br&gt;I am using Hugs 98
&lt;br&gt;I have that piece of code:
&lt;br&gt;&lt;br&gt;class PlusTimes a where
&lt;br&gt;&amp;nbsp; &amp;nbsp;plus :: a -&amp;gt; a -&amp;gt; a
&lt;br&gt;&lt;br&gt;instance PlusTimes Int where
&lt;br&gt;&amp;nbsp; &amp;nbsp;plus x y = x + y
&lt;br&gt;&lt;br&gt;when I run : &amp;quot;plus 2 3&amp;quot; I get this error:
&lt;br&gt;ERROR - Unresolved overloading
&lt;br&gt;*** Type &amp;nbsp; &amp;nbsp; &amp;nbsp; : (Num a, PlusTimes a) =&amp;gt; a
&lt;br&gt;*** Expression : plus 2 3
&lt;br&gt;&lt;br&gt;What am I doing wrong?
&lt;br&gt;Thanks.
&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/classes-question-tp26271257p26271257.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26271139</id>
	<title>Re: Observer pattern in Haskell?</title>
	<published>2009-11-09T10:15:52Z</published>
	<updated>2009-11-09T10:15:52Z</updated>
	<author>
		<name>Andy Gimblett-2</name>
	</author>
	<content type="html">&lt;br&gt;On 9 Nov 2009, at 17:41, Neil Brown wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Just to clarify -- I meant access to another MVar. &amp;nbsp;Basically, if I &amp;nbsp;
&lt;br&gt;&amp;gt; do this:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; do v &amp;lt;- newMVar
&lt;br&gt;&amp;gt; &amp;nbsp; addObserver sub (putMVar v)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; If when the observers are run, the MVar v (that I've allocated) is &amp;nbsp;
&lt;br&gt;&amp;gt; non-empty, my code will block until it is empty, which will also &amp;nbsp;
&lt;br&gt;&amp;gt; block all the subsequent observers from being run (and block the &amp;nbsp;
&lt;br&gt;&amp;gt; code that called setValue) until the MVar is cleared by another &amp;nbsp;
&lt;br&gt;&amp;gt; thread. &amp;nbsp;So my one poorly-written observer could deadlock (or cause &amp;nbsp;
&lt;br&gt;&amp;gt; stutter in) the system, whereas in the forkIO version, this observer &amp;nbsp;
&lt;br&gt;&amp;gt; would be fine -- it would block in its own new thread.
&lt;/div&gt;&lt;br&gt;Ah yes, of course - I understand. &amp;nbsp;Of course, there's nothing really &amp;nbsp;
&lt;br&gt;to stop application authors doing such things in the main thread &amp;nbsp;
&lt;br&gt;too... &amp;nbsp;;-)
&lt;br&gt;&lt;br&gt;Thanks for the clarification,
&lt;br&gt;&lt;br&gt;-Andy
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26271139&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Observer-pattern-in-Haskell--tp26267269p26271139.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26271065</id>
	<title>Re: O'Haskell</title>
	<published>2009-11-09T10:11:21Z</published>
	<updated>2009-11-09T10:11:21Z</updated>
	<author>
		<name>Joe Fredette</name>
	</author>
	<content type="html">That sounds vaguely ominous... &amp;quot;Sir, we've achieved reactive in &amp;nbsp;
&lt;br&gt;O'Haskell, we'll have ten minutes till the VB GUI detects his IP &amp;nbsp;
&lt;br&gt;address!&amp;quot;
&lt;br&gt;&lt;br&gt;...
&lt;br&gt;&lt;br&gt;But in all seriousness, it is my understanding that O'Haskell has &amp;nbsp;
&lt;br&gt;fallen into disuse. IIRC Timber is the spiritual successor, but I have
&lt;br&gt;no idea how accurate that information is.
&lt;br&gt;&lt;br&gt;As for implementing reactive in such a language, I imagine it would be &amp;nbsp;
&lt;br&gt;pretty easy, as FRP is a _functional_ (hence the name) construct.
&lt;br&gt;Objects ought only get in the way (assuming they introduce possibly &amp;nbsp;
&lt;br&gt;conflicting syntax)
&lt;br&gt;&lt;br&gt;&lt;br&gt;/Joe
&lt;br&gt;&lt;br&gt;On Nov 9, 2009, at 7:17 AM, shengwang wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Somebody has idea, how to achieve reactive in O'Haskell?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Shawn Wang
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 使用新一代 Windows Live Messenger 轻松交流和共享！ 立刻下载！ &amp;nbsp;
&lt;br&gt;&amp;gt; _______________________________________________
&lt;br&gt;&amp;gt; Haskell-Cafe mailing list
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26271065&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;/div&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26271065&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/O%27Haskell-tp26265481p26271065.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26270566</id>
	<title>Re: Observer pattern in Haskell?</title>
	<published>2009-11-09T09:41:32Z</published>
	<updated>2009-11-09T09:41:32Z</updated>
	<author>
		<name>Neil Brown-7</name>
	</author>
	<content type="html">Andy Gimblett wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; was a bit surprised at first that the observers were called 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; synchronously. &amp;nbsp;Asynchronous is what I'd expect, and it's also 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; harder to code the asynchronous handlers wrongly. &amp;nbsp;One blocking call 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; (such as putMVar) in a synchronous handler can screw up your whole 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; program by delaying the subsequent observers (and at that stage, the 
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; order in which the observers were added begins to matter).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; True, but the observers shouldn't be able to access the MVars 
&lt;br&gt;&amp;gt; directly, I think? &amp;nbsp;They should only be able to use the exposed 
&lt;br&gt;&amp;gt; interface, which won't let that happen?
&lt;br&gt;&amp;gt;
&lt;/div&gt;Just to clarify -- I meant access to another MVar. &amp;nbsp;Basically, if I do this:
&lt;br&gt;&lt;br&gt;do v &amp;lt;- newMVar
&lt;br&gt;&amp;nbsp; &amp;nbsp; addObserver sub (putMVar v)
&lt;br&gt;&lt;br&gt;If when the observers are run, the MVar v (that I've allocated) is 
&lt;br&gt;non-empty, my code will block until it is empty, which will also block 
&lt;br&gt;all the subsequent observers from being run (and block the code that 
&lt;br&gt;called setValue) until the MVar is cleared by another thread. &amp;nbsp;So my one 
&lt;br&gt;poorly-written observer could deadlock (or cause stutter in) the system, 
&lt;br&gt;whereas in the forkIO version, this observer would be fine -- it would 
&lt;br&gt;block in its own new thread.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&lt;br&gt;Neil.
&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26270566&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Observer-pattern-in-Haskell--tp26267269p26270566.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26270551</id>
	<title>Re: ANNOUNCE: feldspar-language</title>
	<published>2009-11-09T09:41:25Z</published>
	<updated>2009-11-09T09:41:25Z</updated>
	<author>
		<name>Tom Hawkins-2</name>
	</author>
	<content type="html">On Mon, Nov 9, 2009 at 10:09 AM, Emil Axelsson &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26270551&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;emax@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Nice!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; One of our project members has been looking at Atom, not for numerical
&lt;br&gt;&amp;gt; computations, but for real-time scheduling (which Feldspar should deal with
&lt;br&gt;&amp;gt; eventually).
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What kind of code (in terms of efficiency) does the above description
&lt;br&gt;&amp;gt; compile to?
&lt;br&gt;&lt;br&gt;Here's and example:
&lt;br&gt;&lt;br&gt;module Main (main) where
&lt;br&gt;&lt;br&gt;import Language.Atom
&lt;br&gt;&lt;br&gt;main :: IO ()
&lt;br&gt;main = do
&lt;br&gt;&amp;nbsp; compile &amp;quot;filter&amp;quot; defaults design
&lt;br&gt;&amp;nbsp; return ()
&lt;br&gt;&lt;br&gt;design :: Atom ()
&lt;br&gt;design = atom &amp;quot;filter&amp;quot; $ do
&lt;br&gt;&amp;nbsp; input &amp;nbsp;&amp;lt;- float' &amp;quot;input&amp;quot;
&lt;br&gt;&amp;nbsp; output &amp;lt;- float' &amp;quot;output&amp;quot;
&lt;br&gt;&amp;nbsp; x &amp;lt;- iirFilter &amp;quot;filter&amp;quot; 1 [(2,3), (4,5)] (value input)
&lt;br&gt;&amp;nbsp; output &amp;lt;== x
&lt;br&gt;&lt;br&gt;-- | IIR filter implemented using direct form 2.
&lt;br&gt;iirFilter :: Name -&amp;gt; Float -&amp;gt; [(Float, Float)] -&amp;gt; E Float -&amp;gt; Atom (E Float)
&lt;br&gt;iirFilter name b0 coeffs x = do
&lt;br&gt;&amp;nbsp;-- Create the filter taps.
&lt;br&gt;&amp;nbsp;vs &amp;lt;- mapM (\ i -&amp;gt; float (name ++ show i) 0) [1 .. length coeffs]
&lt;br&gt;&amp;nbsp;-- Cascade the filter taps together.
&lt;br&gt;&amp;nbsp;mapM_ (\ (vA, vB) -&amp;gt; vA &amp;lt;== value vB) $ zip (tail vs) vs
&lt;br&gt;&amp;nbsp;-- Calculate the input to the chain of taps.
&lt;br&gt;&amp;nbsp;let w0 = sum ( x : &amp;nbsp;[ (value v) * Const (-a) | (v, (a, _)) &amp;lt;- zip vs coeffs ])
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;bs = b0 : (snd $ unzip coeffs)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;ws = w0 : map value vs
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;us = [ w * Const b | (w, b) &amp;lt;- zip ws bs ]
&lt;br&gt;&amp;nbsp;head vs &amp;lt;== w0
&lt;br&gt;&amp;nbsp;-- Return the output.
&lt;br&gt;&amp;nbsp;return $ sum us
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Here's the generated C. &amp;nbsp;Note the filter calculation is done entirely
&lt;br&gt;by function __r0:
&lt;br&gt;&lt;br&gt;&lt;br&gt;static unsigned long long __global_clock = 0;
&lt;br&gt;static const unsigned long __coverage_len = 1;
&lt;br&gt;static unsigned long __coverage[1] = {0};
&lt;br&gt;static unsigned long __coverage_index = 0;
&lt;br&gt;static float __v1 = 0; &amp;nbsp;/* filter.filter.filter2 */
&lt;br&gt;static float __v0 = 0; &amp;nbsp;/* filter.filter.filter1 */
&lt;br&gt;&lt;br&gt;&lt;br&gt;/* filter.filter */
&lt;br&gt;static void __r0(void) {
&lt;br&gt;&amp;nbsp; unsigned char __0 = 1;
&lt;br&gt;&amp;nbsp; float __1 = 0.0;
&lt;br&gt;&amp;nbsp; float __2 = input;
&lt;br&gt;&amp;nbsp; float __3 = __1 + __2;
&lt;br&gt;&amp;nbsp; float __4 = __v0 /* filter.filter.filter1 */ ;
&lt;br&gt;&amp;nbsp; float __5 = -2.0;
&lt;br&gt;&amp;nbsp; float __6 = __4 * __5;
&lt;br&gt;&amp;nbsp; float __7 = __3 + __6;
&lt;br&gt;&amp;nbsp; float __8 = __v1 /* filter.filter.filter2 */ ;
&lt;br&gt;&amp;nbsp; float __9 = -4.0;
&lt;br&gt;&amp;nbsp; float __10 = __8 * __9;
&lt;br&gt;&amp;nbsp; float __11 = __7 + __10;
&lt;br&gt;&amp;nbsp; float __12 = 1.0;
&lt;br&gt;&amp;nbsp; float __13 = __11 * __12;
&lt;br&gt;&amp;nbsp; float __14 = __1 + __13;
&lt;br&gt;&amp;nbsp; float __15 = 3.0;
&lt;br&gt;&amp;nbsp; float __16 = __4 * __15;
&lt;br&gt;&amp;nbsp; float __17 = __14 + __16;
&lt;br&gt;&amp;nbsp; float __18 = 5.0;
&lt;br&gt;&amp;nbsp; float __19 = __8 * __18;
&lt;br&gt;&amp;nbsp; float __20 = __17 + __19;
&lt;br&gt;&amp;nbsp; if (__0) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; __coverage[0] = __coverage[0] | (1 &amp;lt;&amp;lt; 0);
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&amp;nbsp; output = __20;
&lt;br&gt;&amp;nbsp; __v0 /* filter.filter.filter1 */ = __11;
&lt;br&gt;&amp;nbsp; __v1 /* filter.filter.filter2 */ = __4;
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;&lt;br&gt;void filter(void) {
&lt;br&gt;&amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; static unsigned char __scheduling_clock = 0;
&lt;br&gt;&amp;nbsp; &amp;nbsp; if (__scheduling_clock == 0) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; __r0(); &amp;nbsp;/* filter.filter */
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; __scheduling_clock = 0;
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; else {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; __scheduling_clock = __scheduling_clock - 1;
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; __global_clock = __global_clock + 1;
&lt;br&gt;}
&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26270551&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/ANNOUNCE%3A-feldspar-language-tp26190576p26270551.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26270513</id>
	<title>Re: Cabal</title>
	<published>2009-11-09T09:40:01Z</published>
	<updated>2009-11-09T09:40:01Z</updated>
	<author>
		<name>Stephen Tetley-2</name>
	</author>
	<content type="html">2009/11/9 Duncan Coutts &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26270513&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;duncan.coutts@...&lt;/a&gt;&amp;gt;:
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; That should work, and probably the recommendation should be for cygwin
&lt;br&gt;&amp;gt; users to edit their cabal config to at add C:\cygwin\lib and C:\cygwin
&lt;br&gt;&amp;gt; \usr\include as standard.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Hi Duncan
&lt;br&gt;&lt;br&gt;That would definitely be the best idea, but where does the cabal config live?
&lt;br&gt;&lt;br&gt;I have the cabal that ships with GHC-6.10.3 and can't find anything:
&lt;br&gt;&lt;br&gt;cabal-install version 0.6.0
&lt;br&gt;using version 1.6.0.1 of the Cabal library
&lt;br&gt;&lt;br&gt;&lt;br&gt;By the way, this one should be unnecessary, it was a legacy of me
&lt;br&gt;hacking all sorts of things to get readline installed:
&lt;br&gt;&lt;br&gt;&amp;nbsp;--extra-include-dirs=C:\cygwin\usr\include\readline
&lt;br&gt;&lt;br&gt;Best wishes
&lt;br&gt;&lt;br&gt;Stephen
&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26270513&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Cabal-tp26260794p26270513.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26269832</id>
	<title>Re: Observer pattern in Haskell?</title>
	<published>2009-11-09T09:00:12Z</published>
	<updated>2009-11-09T09:00:12Z</updated>
	<author>
		<name>Andy Gimblett-2</name>
	</author>
	<content type="html">&lt;br&gt;On 9 Nov 2009, at 16:47, Eduard Sergeev wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Andy Gimblett-2 wrote:
&lt;br&gt;&amp;gt;&amp;gt; Possibly. &amp;nbsp;Care to expand? &amp;nbsp;If you have a more elegant solution, &amp;nbsp;
&lt;br&gt;&amp;gt;&amp;gt; which
&lt;br&gt;&amp;gt;&amp;gt; fits in well with ordinary wxHaskell, I'd be interested.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I believe there are a few experimental frameworks built on top of &amp;nbsp;
&lt;br&gt;&amp;gt; wxHaskell
&lt;br&gt;&amp;gt; which use Functional Reactive Programming, like
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://www.haskell.org/haskellwiki/Phooey&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/haskellwiki/Phooey&lt;/a&gt;&amp;nbsp;Phooey . They seem to be &amp;nbsp;
&lt;br&gt;&amp;gt; more
&lt;br&gt;&amp;gt; ellegant, but probably less practical for now since they are still
&lt;br&gt;&amp;gt; experimental. I just thought that FRP is more suitable for Haskell but
&lt;br&gt;&amp;gt; probably in case of wxHaskell it is not a case. Sorry if it was off &amp;nbsp;
&lt;br&gt;&amp;gt; topic.
&lt;/div&gt;&lt;br&gt;In that case, I am 100% in agreement with you. &amp;nbsp;:-) &amp;nbsp;I do look forward &amp;nbsp;
&lt;br&gt;to using such technology in the future...
&lt;br&gt;&lt;br&gt;Thanks!
&lt;br&gt;&lt;br&gt;-Andy
&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26269832&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Observer-pattern-in-Haskell--tp26267269p26269832.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26269641</id>
	<title>Re: Cabal</title>
	<published>2009-11-09T08:50:12Z</published>
	<updated>2009-11-09T08:50:12Z</updated>
	<author>
		<name>Duncan Coutts-4</name>
	</author>
	<content type="html">On Mon, 2009-11-09 at 13:08 +0000, Stephen Tetley wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; At this point I'd edit the *.cabal files in each component – this is
&lt;br&gt;&amp;gt; not 'the done thing', but both libraries need extra flags and as I
&lt;br&gt;&amp;gt; have to compile them rarely I tend to forget the format (which appears
&lt;br&gt;&amp;gt; to be Windows style full paths even though you are running Cygwin).
&lt;br&gt;&lt;br&gt;Does it not work to say:
&lt;br&gt;&lt;br&gt;cabal install readline \
&lt;br&gt;&amp;nbsp; --extra-lib-dirs=C:\cygwin\lib \
&lt;br&gt;&amp;nbsp; --extra-include-dirs=C:\cygwin\usr\include \
&lt;br&gt;&amp;nbsp; --extra-include-dirs=C:\cygwin\usr\include\readline
&lt;br&gt;&lt;br&gt;That should work, and probably the recommendation should be for cygwin
&lt;br&gt;users to edit their cabal config to at add C:\cygwin\lib and C:\cygwin
&lt;br&gt;\usr\include as standard.
&lt;br&gt;&lt;br&gt;Duncan
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;Haskell-Cafe mailing list
&lt;br&gt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26269641&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;Haskell-Cafe@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://www.haskell.org/mailman/listinfo/haskell-cafe&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.haskell.org/mailman/listinfo/haskell-cafe&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Cabal-tp26260794p26269641.html" />
</entry>

</feed>
