I see that (!!) for Data.Stream has arguments reversed, compared to !! on lists. The Haddock comment, however, suggests otherwise. Is the argument reversal intended? - Conal<br><br>From Data.Stream:<br><br><span style="font-family: courier new,monospace;">
-- | @xs !! n@ returns the element of the stream @xs@ at index</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-- @n@. Note that the head of the stream has index 0.</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-- </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-- /Beware/: passing a negative integer as the first argument will cause
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-- an error.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
(!!) :: Int -> Stream a -> a</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(!!) n (Cons x xs)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
| n == 0 = x</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> | n > 0 = (!!) (n - 1) xs</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
| otherwise = error "Stream.!! negative argument"</span><br><br><br>