Честно говоря лень уже дальше разбираться. Мое знание Хаскеля достаточно базовое и довольно тяжело копаться даже в несложных кусках.
Погуглив по словам "haskell do imperative" обнаружил кучу упоминаний о том, что на хаскеле можно (но не нужно) писать имеративно, применяя монады, что do-нотация является псевдоимперативной или imperative style и так далее.
А ещё есть шутка, что Хаскелл --- это лучший императивный язык.
Criticism
Haskell's do notation is popular and ubiquitous. However we shall not ignore that there are several problems. Here we like to shed some light on aspects you may not have thought about, so far.
Didactics
The do notation hides functional details. This is wanted in order to simplify writing imperative style code fragments. The downsides are that:
- Since do notation is used almost everywhere IO takes place, newcomers quickly believe that the do notation is necessary for doing IO,
- Newcomers might think that IO is somehow special and non-functional, in contrast to the advertisement for Haskell being purely functional,
- Newcomers might think that the order of statements determines the order of execution.
Обрати внимание на последний пункт. Да и остальные.
Ну и там далее в статье примеры "misunderstanding"