Hi folks
I'm having a play with Concurrent Haskell, and came across this in the
library.
readMVar :: MVar a -> IO a
This is a combination of takeMVar and putMVar; ie. it takes the value
from the MVar, puts it back, and also returns it.
I was just wondering if I understand things correctly. Su
at a guess the magic take put is:
block ( do
a <- takeMVar x
putMVar x a
)
return a
Keean.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe
> -- gaSolutionSpace :: [a] -> [a]
> -- gaSolutionSpace [] = gaSolutionSpace createRandomPopulation -- recursive
> base case
> gaSolutionSpace x = x : gaSolutionSpace (evolvepopulation x)
This isn't quite right - you don't want the *last* element to be the initial
population, but the first.
I t
On 02 July 2004 10:16, Conor T McBride wrote:
> Hi folks
>
> I'm having a play with Concurrent Haskell, and came across this in the
> library.
>
>readMVar :: MVar a -> IO a
>This is a combination of takeMVar and putMVar; ie. it takes the
>value from the MVar, puts it back, and also r
On Jun 29, 2004, at 6:46 PM, Iavor S. Diatchki wrote:
In Haskell, natural transformations are polymorphic functions, tau
:: f a -> g a. For example, maybeToList :: Maybe a -> [a].
actually i think this is a good approximation. not all polymorphic
functions are natural transformations, but "simp
I am trying to model state in the continuation monad,
such that each continuation recieves the current state
as one of its arguments. The state must vary in type,
which is why I am trying to use the continuation monad,
but things don't seem to be going too well.
To clarify... imagine the following
> at a guess the magic take put is:
>
> block ( do
> a <- takeMVar x
> putMVar x a
> )
> return a
This doesn't prevent the race condition Conor mentioned. It only prevents
the thread executing the above code from being interrupted by an
asynchronous exception (i.e., Control-C, or another thread
{-# OPTIONS -fglasgow-exts #-}
{-
Regarding Keean's posting ...
I wonder whether perhaps a more basic step is to understand
how type-changing monadic computations can be understood.
By this I mean, that the effects model by the monad can change
their type as part of the computation. Such a monad
Conor T McBride wrote:
... [questions about operation ordering with MVars]
>
I'm only asking, because I'm trying to cook up some kind of partial
evaluator for programs which are being simultaneously edited by
fiercely argumentative devils. Kind of `demonic laziness', where
the computations decide w
hello,
i was thinking of higher-order functions, which i think complicate things
(i might be wrong though :-)
for example:
fix :: (a -> a) -> a
is ploymorphic, but is it a natural tranformation?
i belive it is in fact a di-natural transformation.
-iavor
On Jun 29, 2004, at 6:46 PM, Iavor S. Diatchk
The idea of using a general purpose programming language for making music
as provided by Haskore is very attractive to me. Especially Haskell seems
to be a good choice for this task, since the lazy evaluation in principle
allows an immediate play back without the necessity to build the complete
so
Crypt Master writes:
>From what I can see, a key difficulty you're having is with the
"evolvepopulation" function. You've given it the type a -> a, which
pretty much requires it to be an identity function, because it's not
allowed to make any assumptions about the values it takes.
To make things
12 matches
Mail list logo