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
___
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
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
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
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
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
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
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
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
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
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:
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.
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
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
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]
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
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
-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
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]
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,
Title: ·ºÎ¢ÍøÂç
haskell£¬ÄúºÃ£¡
Ê×ÏÈ£¬¸ÐлÄú¶Ô·ºÎ¢µÄ¹Ø×¢ºÍÖ§³Ö£¡
·ºÎ¢ÍøÂçÓÐÏÞ¹«Ë¾ÊÇÒ»¼Òרҵ´ÓÊ»¥ÁªÍøÆóÒµÓ¦Ó÷þÎñµÄ¹«Ë¾¡£¾¹ý2000-2001ÄêµÄ·¢Õ¹£¬·ºÎ¢ÍøÂçÔÚÌṩÆóÒµ»¥ÁªÍøÓ¦Ó÷þÎñ·½ÃæÒÑ»ýÀÛÁËϵÁнâ¾ö·½°¸£¬²¢Ôڳɹ¦¿Í»§»ù´¡Á˼¯³ÉÁËϵÁлùÓÚWEBµÄרҵ¹ÜÀíÈí¼þ²úÆ·¡£
[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
| 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
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
24 matches
Mail list logo