John Hughes despaired:
| Oh no, please don't do this! I use the RefMonad class,
| but *without* the dependency r - m. Why not? Because
| I want to manipulate (for example) STRefs in monads
| built on top of the ST monad via monad transformers.
| So I use the same reference type with *many
At 2002-02-06 00:33, Koen Claessen wrote:
Hm... this looks nice. With slight name changes this
becomes:
Oh if you must. I decided that Refs were _so_ fundamental that anytime
you get, set or modify anything it could probably be represented as a
Ref, so the functions merit highly generic
John Hughes despaired:
| Oh no, please don't do this! I use the RefMonad class,
| but *without* the dependency r - m. Why not? Because
| I want to manipulate (for example) STRefs in monads
| built on top of the ST monad via monad transformers.
At 2002-02-06 01:09, John Hughes wrote:
No no no! This still makes the reference type depend on the monad type, which
means that I cannot manipulate the same reference in two different monads!
Yes you can. Consider:
-- m somehow uses 'rep' internally
class (Monad rep, Monad m) =
At 2002-02-06 00:54, Koen Claessen wrote:
You are completely right, of course I meant r - m!
Right. There's the equivalent of an r - m dependency because m is a
parameter in the Ref type constructor. But it doesn't matter, because you
can create values of this type:
myIntRef :: (MyMonad
Ashley Yakeley wrote:
At 2002-02-06 01:09, John Hughes wrote:
No no no! This still makes the reference type depend on the monad type, which
means that I cannot manipulate the same reference in two different monads!
Yes you can. Consider:
-- m
DOCTORAL RESEARCH GRANT
Extensions of Logic Programming and Formal Methods
**
The Department of Software of the Technical University
of Valencia UPV (Spain), offers one research scholarship
to pursue a Ph.D. degree in the
Extensions
Hello.
Please, tell me which set of definitions below should I expected
to be more efficient: the reverse1 or the reverse2 functions.
reverse1 [] ys = ys
reverse1 (x:xs) ys = reverse2 (x:ys) xs
reverse2 ys [] = ys
reverse2 ys (x:xs) = reverse2 (x:ys) xs
The difference rely on the
At 2002-02-06 03:38, John Hughes wrote:
Well, I'm still not convinced. A reference *value* can't have the type
(LiftedMonad (ST s) m) = Ref m a
Oh, yeah, you're right. I made a mistake here:
newSTRef :: a - Ref (ST s) a;
newSTLiftedRef :: (LiftedMonad (ST
Hi.
I want to join please.
thanks in advance.
Ilan.
Well, I assume you meant:
reverse1 [] ys = ys
reverse1 (x:xs) ys = reverse1 xs (x:ys)
reverse2 ys [] = ys
reverse2 ys (x:xs) = reverse1 (x:ys) xs
If so, and you make two programs:
main = print (length $! reverse1 [1..200] [])
and
main = print (length $! reverse2 [] [1..200])
| -Original Message-
| From: Sigbjorn Finne [mailto:[EMAIL PROTECTED]]
| Sent: Wednesday, February 06, 2002 1:27 AM
| To: Ashley Yakeley
| Cc: GHC List
| Subject: Re: Binary Compatibility
|
|
| Apologies if this has been covered before. What
| compatibility is there
| between
This one may be fairly basic, but I was wondering if there's a common
idiom for boxing a parameterized datatype into a non-parameterized
one, and accessing the components in a unified manner. (hope I said
that right, pretend I mentioned polymorphism somewhere)
module VarExample where
For
On Wed, 6 Feb 2002, David Feuer wrote:
a more adventurous note, I think it would be very
interesting to be able to ask the compiler to make certain
values persistent across program executions. This could
solve the same problem, but may also help deal with long
computations that may be
|- newtypes support deriving *any* class for which the
| underlying type is also an instance.
|
| How about multi-parameter classes where there are instances for the
| underlying type on more than one parameter: is it possible to specify
| which parameter the newtype is being
Dear all,
We've been working on bulding an interpreter in haskell
and we seem to have encountered a problem.
At the end of the email I've pasted a minimal version of the program,
that shows the error.
The problem is that we 'putStr' a prompt onto (unbuffered) stdout
and then read a line,
The problem here is that, within the `while' you are calling `isEOF'
before printing the prompt. IsEOF cannot report False until you
actually type the first character! If you type nothing, then it the
EOF condition could indeed be true, so no more actions can happen until
the condition is
Can someone explain the following warning?
---
module Warning where
type A = IO ()
class CA t
where a :: t - A
instance CA ()
where a = return
instance (CA t) = CA (IO t)
where a = (= a)
data B = B A
class CB t
where b :: t - B
instance (CA t) = CB (IO
18 matches
Mail list logo