Re: State Transformer

2002-01-11 Thread Theodore Norvell
Jorge's question raised a question in my mind. The IOExts module has many of the same features as the ST module, why are there two ways to do the same thing? Is the ST module only there for legacy purposes? Cheers, Theo Norvell ___

Re: State Transformer

2002-01-11 Thread Jan-Willem Maessen
Theodore Norvell [EMAIL PROTECTED] asks: Jorge's question raised a question in my mind. The IOExts module has many of the same features as the ST module, why are there two ways to do the same thing? Is the ST module only there for legacy purposes? The ST monad provides safer encapsulation

Re: FFI

2002-01-11 Thread Sigbjorn Finne
Hi, GreenCard is still widely used, but doesn't offer any support for what you're wanting to do. Is the auto-generation of proxy code around the Haskell functions you want to export worth your while to get started with HDirect? Don't know, you may want to try doing it manually for a couple of

Re: State Transformer

2002-01-11 Thread Jan de Wit
Hi, testfunc = do r - newSTRef ('x',0) foo r bar r (c,n) - readSTRef r return n Yeap, I could do it like this myself :) The whole problem is with passing the 'r' as a parameter, which is precisly what I'm trying to avoid. I

Re: State Transformer

2002-01-11 Thread Albert Lai
testfunc = do r - newSTRef ('x',0) foo r bar r (c,n) - readSTRef r return n Jorge Adriano [EMAIL PROTECTED] writes: Yeap, I could do it like this myself :) The whole problem is with passing the 'r' as a parameter, which is

Re: State Transformer

2002-01-11 Thread Albert Lai
Theodore Norvell [EMAIL PROTECTED] writes: Jorge's question raised a question in my mind. The IOExts module has many of the same features as the ST module, why are there two ways to do the same thing? Is the ST module only there for legacy purposes? My user view is that I appreciate the

Re: State Transformer

2002-01-11 Thread Jorge Adriano
If I understand you correctly, you want global mutable variables, right? This is, I believe, only possible using IORef's and unsafePerformIO. Kind of, I'm searching for the best approach to keep track of data in my algorithms without constantly changing signatures. State monad as defined in

Re: State Transformer

2002-01-11 Thread Jorge Adriano
I agree with you. My work-around is then to define foo and bar locally to testfunc, in the scope of r: testfunc = do r - newSTRef ('x',0) let foo = do (c,n) - readSTRef r writeSTRef r ('a', n+1) bar = do

Re: State Transformer

2002-01-11 Thread Theodore Norvell
DIY monads are good when: you fix the state variables, you don't want to mention them in subprogram parameters. I've taken this solution for a fairly large piece of software. One word of warning about DIY state monads, you have to be very carefull about strictness and lazyness. If your monad

Re: FFI

2002-01-11 Thread Manuel M. T. Chakravarty
Mark Conway Wirt [EMAIL PROTECTED] wrote, I'm looking for opinions as to the best way to do a C (or C++) foreign interface to GHC haskell code. It looks like there are three options. I think, there are five options: * H/Direct (you mentioned that already) * GreenCard (ditto) * C-Haskell

Re: State Transformer

2002-01-11 Thread Eray Ozkural (exa)
On Friday 11 January 2002 19:39, Jan-Willem Maessen wrote: The ST monad provides safer encapsulation of mutable references. We can prove that references which escape a particular instance of ST are never side effected. See the paper Lazy Functional State Threads:

Re: GHC version 5.02.2 is available - RPMs

2002-01-11 Thread Manuel M. T. Chakravarty
Julian Seward (Intl Vendor) [EMAIL PROTECTED] wrote, The (Interactive) Glasgow Haskell Compiler -- version 5.02.2 == We are pleased to announce a new patchlevel release of the Glasgow Haskell Compiler (GHC), version 5.02.2.

Re: State Transformer

2002-01-11 Thread Ashley Yakeley
At 2002-01-11 06:18, Jorge Adriano wrote: The whole problem is with passing the 'r' as a parameter, which is precisly what I'm trying to avoid. You could always pass it implicitly (using -fglasgow-exts): -- testfunc = do r - newSTRef ('x',0) (do foo

Re: State Transformer

2002-01-11 Thread Theodore Norvell
DIY? what does that means? Do It Yourself. I.e. as in my tutorial. What if you want both and keep nice clean(*) programming style... :-) You can compose monads. I've done something like the following in the past (only with IO): data StateTrans s a = StateTrans (s - ST (s,a)) Here s is

Yell

2002-01-11 Thread Ashley Yakeley
This message constitutes a yell. http://www.haskell.org/ghc/docs/latest/set/implicit-parameters.html Thanks in advance... -- Ashley Yakeley, Seattle WA ___ Glasgow-haskell-users mailing list [EMAIL PROTECTED]

RE: Programming style question

2002-01-11 Thread D. Tweed
On Thu, 10 Jan 2002, Mark P Jones wrote: | If I have defined a function like this.. | f args = blah args | it could be re-written.. | f = blah [snip] - The second will compute a value of blah at most once, then cache the result for future use. That could make a program run

Re: A Haskell specific preprocessor

2002-01-11 Thread Keith Wansbrough
Olaf writes: I faintly remember that there was once work on a Haskell specific preprocessor. Why was the work abandoned? I had some ideas, which I put together in a note http://www.cl.cam.ac.uk/~kw217/research/paper-abstracts.html#Wansbrough99:Macros but most people seemed to believe that a

Re: A Haskell specific preprocessor

2002-01-11 Thread Eray Ozkural (exa)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Friday 11 January 2002 15:04, Keith Wansbrough wrote: but most people seemed to believe that a lazy language shouldn't need macros or a preprocessor (despite the liberal use of both in GHC, for example). I'm hoping I will not have to use any

Re: Programming style question

2002-01-11 Thread Adrian Hey
On Friday 11 January 2002 8:46 am, D. Tweed wrote: Even sillier question: there's no other way of getting the optimization that normCorr' has over normCorr (as always on the understanding it may be a space leak) in Haskell? dotProd xs ys=sum(zipWith (*) xs ys) normCorr :: Floating a = [a]

Re: Programming style question

2002-01-11 Thread Adrian Hey
Thanks Mark, On Friday 11 January 2002 7:41 am, Mark P Jones wrote: Denotationally, the two expressions are the same. (In other words, they both produce the same value.) But the example above shows an operational difference in some implementation. (As far as I can tell, however,

To:haskell,

2002-01-11 Thread contact
Title: ·ºÎ¢ÍøÂç haskell£¬ÄúºÃ£¡ Ê×ÏÈ£¬¸ÐлÄú¶Ô·ºÎ¢µÄ¹Ø×¢ºÍÖ§³Ö£¡ ·ºÎ¢ÍøÂçÓÐÏÞ¹«Ë¾ÊÇÒ»¼Òרҵ´ÓÊ»¥ÁªÍøÆóÒµÓ¦Ó÷þÎñµÄ¹«Ë¾¡£¾­¹ý2000-2001ÄêµÄ·¢Õ¹£¬·ºÎ¢ÍøÂçÔÚÌṩÆóÒµ»¥ÁªÍøÓ¦Ó÷þÎñ·½ÃæÒÑ»ýÀÛÁËϵÁнâ¾ö·½°¸£¬²¢Ôڳɹ¦¿Í»§»ù´¡Á˼¯³ÉÁËϵÁлùÓÚWEBµÄרҵ¹ÜÀíÈí¼þ²úÆ·¡£

Re: State Transformer

2002-01-11 Thread Jorge Adriano
[Obs: most answers I got end up in my pvt e-mail and not in the mailing list... I replyed in pvt to those. I do feel it some cases that is probably accidental as I do it all the time :), and the discussion ends leaving the mailing list. So i'd just like to let you know that I for one am in

differential operation (Typing Question!)

2002-01-11 Thread Jay Cox
| Message: 1 | From: Zhe Fu [EMAIL PROTECTED] | To: [EMAIL PROTECTED] | Subject: how to implement the differential operation with Haskell? | Date: Wed, 9 Jan 2002 00:37:20 -0800 | | Is there any built-in functions in Haskell to implement diffential | operation? Or can anyone give me some advices

Re: Haskell-Cafe digest, Vol 1 #293 - 4 msgs

2002-01-11 Thread Jay Cox
Message: 4 From: Jorge Adriano [EMAIL PROTECTED] To: [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: State Transformer Date: Mon, 7 Jan 2002 15:41:57 + snip Till then I had just read what I needed to be able to use the IO Monad. Seems to me like having a State Transformer monad its