#haskell - Tue 20 Mar 2007 between 00:12 and 00:19

NY Lost Funds



newsham(a:) `fmap` iteratemM f (f a) ?
LoganCapaldoI'm not really sure what it should look like :)
mdmkolbe@ty let iterateM act val = do {x <- act val; xs <- iterateM act x; return (x:xs) } in iterateM
lambdabotforall t (t1 :: * -> *). (Monad t1) => (t -> t1 t) -> t -> t1 [t]
LoganCapaldoI guess somewhat like that :)
encryptio:t let iterateM f v = iterate (>>= . f) (return v)
newshamexcept the normal "iterate" also returns the arg as its first value
lambdabotparse error on input `.'
encryptio:t let iterateM f v = iterate (>>= f) (return v) in iterateM
lambdabotforall a (m :: * -> *). (Monad m) => (a -> m a) -> a -> [m a]
encryptioeh, close
:t let iterateM f v = sequence $ iterate (>>= f) (return v) in iterateM
LoganCapaldo:t let iterateM f v = sequence $ iterate (>>= f) (return v) in iterateM
lambdabotAmbiguous occurrence `sequence'
It could refer to either `sequence', imported from Control.Monad.Writer
Ambiguous occurrence `sequence'
It could refer to either `sequence', imported from Control.Monad.Writer
LoganCapaldoLOL
encryptio:t let iterateM f v = Prelude.sequence $ iterate (>>= f) (return v) in iterateM
lambdabotforall a (m :: * -> *). (Monad m) => (a -> m a) -> a -> m [a]
newshamlet iterateM f v = Prelude.sequence $ iterate (>>= f) return v) in iterateM (\x -> return [succ x]) 'a'
> let iterateM f v = Prelude.sequence $ iterate (>>= f) return v) in iterateM (\x -> return [succ x]) 'a'
lambdabotParse error
mdmkolbeLoganCapaldo, newsham: I think that any iterateM that returns a m [a] would have problems with strictness because the modad would have to be completely evaluated before the first element could be removed
encryptionewsham: (return v)
newsham> let iterateM f v = Prelude.sequence $ iterate (>>= f) return v) in iterateM (\x -> [succ x]) 'a'
lambdabotParse error
mdmkolbes/returns a m [a]/reutrns a "m [a]'/
sorearmdmkolbe: monads don't make things stricter
newsham> let iterateM f v = Prelude.sequence $ iterate (>>= f) (return v) in iterateM (\x -> [succ x]) 'a'
lambdabotException: stack overflow
encryptioaww.
sorear@ty let repeatM a = liftM2 (:) a (repeatM a) in repeatM
lambdabotforall (m :: * -> *) a1. (Monad m) => m a1 -> m [a1]
mdmkolbesorear: not always, but often. Consider a state monad. Evaluating the resulting state means that the entire list would have to be generated (which in this case would be an infinite list)
sorear> let repeatM a = liftM2 (:) a (repeatM a) in flip evalState 0 $ repeatM (do { x <- get ; put (x+1) ; return x}) -- mdmkolbe
lambdabot[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,2...
sorearnon strict monads are neat...
actionmdmkolbe does a double take
mdmkolbedoes a double take
sorearof course, this works precisely because I *don't* evaluate the resulting state.

Page: 2 9 16 23 30 37 44 51 58 65 72 79 86 93 100 107 114 121 

IrcArchive

NY Lost Funds