
Hi all, For the past couple of weeks I've been trying to understand tying-the-knot style programming in Haskell. A couple of days ago, Heinrich Apfelmus posted the following 'break' function as part of an unrelated thread: break [] = ([],[]) break (x:xs) = if x == '\n' then ([],xs) else (x:ys,zs) where (ys,zs) = Main.break xs I've stepped through the code manually to see if I understand and I'm hoping someone will tell me if I'm on the right track: -- break "hi\nbye" = -- let f1 = (break "i\nbye") -- = let f2 = (break "\nbye") -- = ([],"bye") -- ('i' : fst f2, snd f2) => ('i' : [], "bye") -- ('h' : fst f1, snd f1) => ('h' : 'i' : [], "bye") -- => ("hi","bye") -deech