background preloader

Bing Question: What is the evaluation order for mcons in: mcons p q = p >>= \x -> q >>= \y -> return (x:y) -- Copilot / Bing Chat Questions / Answers (7/10)

16 march 2024

Bing Question: What is the evaluation order for mcons in: mcons p q = p >>= \x -> q >>= \y -> return (x:y) -- Copilot / Bing Chat Questions / Answers (7/10)

Question:

Related to the above there seems to be ambiguity in the phrase “order of precedence here”. With regards to evaluation the order -- in the case of mcons (shown above) -- the “->” operator seems to get bound first, with real world data. This suggests a higher order of precedence for “->” than the other operators. However, with regards to parsing the operator “->” is associated with less deeply nested brackets, which in a strict language would suggest a lower order of precedence, or equivalently in Haskell lingual, a lower fixity. Fixity is defined in Talb 2 at but this table doesn’t give the fixity for “->”. https://www.haskell.org/onlinereport/decls.html#nested