Zulip Chat Archive

Stream: new members

Topic: Question on Seq


Kevin Cheung (Oct 16 2024 at 15:01):

In the documentation for the class Seq, it is written:

seq : {α β : Type u} → f (α → β) → (Unit → f α) → f β

If mf : F (α → β) and mx : F α, then mf <*> mx : F β. In a monad this is the same as do let f ← mf; x ← mx; pure (f x): it evaluates first the function, then the argument, and applies one to the other.

To avoid surprising evaluation semantics, mx is taken "lazily", using a Unit→ f α function.

My question is on the last sentence: What is an example of a "surprising evaluation semantic" that one would like to avoid?


Last updated: May 02 2025 at 03:31 UTC