
25 Aug
2011
25 Aug
'11
3:18 a.m.
Ehm... what? How can you do such a replacement without losing, for example, functions like this: f (KI s h) i = snd $ h i $ fst $ h i s
Well, if we eliminate the existential from data Kl i o = forall s. Kl s (i -> s -> (s, o)) following strictly the procedure we obtain data S i o = S (i -> (S i o, o)) It is the data type of infinite streams, with an extra input. Your function is obtaining the second element of the stream (assuming the constant input i). Infinite streams form a monad, as described in great detail here: http://patternsinfp.wordpress.com/2010/12/31/stream-monad/