Marcin Kowalczyk wrote:
Indeed, my brain is melting, but I did it :-)
Congratulations. How about we found a "Bound-thread-induced brain melt
victims' support group"?
[...] I have added some optimizations:
I think we had thought of most of these optimizations, but things were
already very complex
On Thu, 3 Mar 2005, Sam G. wrote:
> I need a Monad to represent an internal stack. I mean I've got a lot
> of functions which operates on lists and I would not like to pass the
> list as an argument everytime.
>
> Could you help me writing this monad? To start, I just need a +
> function which wi
On Thu, 2005-03-03 at 02:03 +0100, Sam G. wrote:
> I need a Monad to represent an internal stack. I mean I've got a lot of
> functions which operates on lists and I would not like to pass the list as an
> argument everytime.
>
> Could you help me writing this monad? To start, I just need a + fu
Hello again,
in fact I wrote the following state monad:
--
newtype State state value = State (state -> (state, value))
instance Monad (State state) where
return v = State $ \s -> (s, v)
State f >>= k = State $ \s -> let (s0, v0) = f s
State g = k v0
I need a Monad to represent an internal stack. I mean I've got a lot of
functions which operates on lists and I would not like to pass the list as an
argument everytime.
Could you help me writing this monad? To start, I just need a + function which
will return the sum of the 2 toppest elements
"Simon Marlow" <[EMAIL PROTECTED]> writes:
>> I've now implemented a threaded runtime in my language Kogut, based
>> on the design of Haskell. The main thread is bound. The thread which
>> holds the capability performs I/O multiplexing itself, without a
>> separate service thread.
>
> We found tha
Something like:
class Coerce a b where
coerce :: a -> b
The class must be in a separate file from the instance so that the compiler
does not determine that a == b for all instances.
instance Coerce a a where
coerce = id
If it turns out the left and right types do not match, you get a
"no inst
On Wed, 2 Mar 2005 15:54:51 +0100, Stefan Holdermans
<[EMAIL PROTECTED]> wrote:
> Lemmih,
>
> > And you can "fix" it with some unsafeCoerce# magic. (:
>
> Actually, as I pointed out, the required coercion in perfectly safe,
> though not implicit:
>
> coerceRight :: Either a b -> Either c b
> coe
I'd like to do this sort of thing with types other than Either.
Is there a generic safe coerce function?
-Alex-
On Wed, 2 Mar 2005, Stefan Holdermans wrote:
Lemmih,
And you can "fix" it with some unsafeCoerce# magic. (:
Actually, as I pointed out, the required coercion in perfectly safe, though
no
Lemmih,
And you can "fix" it with some unsafeCoerce# magic. (:
Actually, as I pointed out, the required coercion in perfectly safe,
though not implicit:
coerceRight :: Either a b -> Either c b
coerceRight (Right b) = Right b
Regards,
Stefan
___
Haskell-
On Wed, 2 Mar 2005 09:20:15 -0500 (Eastern Standard Time), S.
Alexander Jacobson <[EMAIL PROTECTED]> wrote:
> My point was that this code seems excessively complex:
>
>fun::(a->a1)->(Either a b)->Either a1 b
>fun f (Left x) = Left (f x)
>fun _ r@(Right x)= Right x
>
> I'd like to avoi
Alex,
fun::(a->a1)->(Either a b)->Either a1 b
fun f (Left x) = Left (f x)
fun _ r@(Right x)= Right x
I'd like to avoid the destruction and construction in the third line
by replacing the right hand side with r. However, the typechecker
then claims my type is wrong. How do I fix that?
You c
My point was that this code seems excessively complex:
fun::(a->a1)->(Either a b)->Either a1 b
fun f (Left x) = Left (f x)
fun _ r@(Right x)= Right x
I'd like to avoid the destruction and construction in the third line
by replacing the right hand side with r. However, the typechecker
then c
On 01 March 2005 11:21, Marcin 'Qrczak' Kowalczyk wrote:
> Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> writes:
>
>> Why is the main thread bound?
>
> I can answer myself: if the main thread is unbound, the end of the
> program can be reached in a different OS thread, which may be a
> problem i
On Wed, 2 Mar 2005, Benjamin Franksen wrote:
> There is a good argument for 'distfix' i.e. bracketing operators, IMO. You
> could define your own if_then_else:
>
> `if cond `then` truebranch `else` falsebranch end`
I would be more happy with
if :: Bool -> a -> a -> a
if True x _ = x
if F
On Wed, 2 Mar 2005, Ben Lippmeier wrote:
> You can play games with the type checker to force them to have the same
> type without changing the "meaning" of your function.
>
> fun1' f (Left x)= if True then Left (f x) else Left x
Left (f x) `asTypeOf` Left x
?
__
16 matches
Mail list logo