FAQ Database Discussion Community

Why doesn't `iterate` from the Prelude tie the knot?

Why isn't iterate defined like iterate :: (a -> a) -> a -> [a] iterate f x = xs where xs = x : map f xs in the Prelude?...

Tie-the-knot in 2 dimensions (was: tying the knot with a comonad)

Edit: The original question was "tying the knot with a comonad", but what really helped here is a two-dimensional knot tying with U2Graph from cirdec. Original question (until Anwser): I want to tie the knot with data that originates from a comonad data U a = U [a] a [a]...