How are list comprehensions implemented in Haskell?
问题 Are list comprehensions simply a language feature? What's the easiest way to fake a list comprehension using pure Haskell? Do you have to use a do block/ >>= to do this or could you use some other method for hacking a list comprehension together? Clarification: By "fake" a list comprehension I mean create a function that takes the same input and produces the same input, i.e. a form for the return values, lists to crunch together, and a predicate or multiple predicates. 回答1: Section 3.11 in