Re: Threading Monads

1998-05-05 Thread S.M.Kahrs
Just to make a couple of obvious observations: Graeme Moss wrote: > A question born out only of curiosity: > > Can anyone provide a definition of `thread' equivalent to this: > > > thread :: Monad m => [a -> m a] -> a -> m a > > thread [] a = return a > > thread (k:ks) a = k a >>= thread k

Re: Threading Monads

1998-05-05 Thread Ralf Hinze
Graeme Moss writes > A question born out only of curiosity: > > Can anyone provide a definition of `thread' equivalent to this: > > > thread :: Monad m => [a -> m a] -> a -> m a > > thread [] a = return a > > thread (k:ks) a = k a >>= thread ks > > not using pattern matching (eg. using map

Re: Threading Monads

1998-05-05 Thread Graeme Moss
Ralf Hinze answers my question: |> Can anyone provide a definition of `thread' equivalent to this: |> |> > thread :: Monad m => [a -> m a] -> a -> m a |> > thread [] a = return a |> > thread (k:ks) a = k a >>= thread ks |> |> not using pattern matching (eg. using map or fold) that does not

Threading Monads

1998-05-05 Thread Graeme Moss
A question born out only of curiosity: Can anyone provide a definition of `thread' equivalent to this: > thread :: Monad m => [a -> m a] -> a -> m a > thread [] a = return a > thread (k:ks) a = k a >>= thread ks not using pattern matching (eg. using map or fold) that does not have a space l