Why Haskell range needs spaces when using [LT .. GT]?

前端 未结 3 1249
猫巷女王i
猫巷女王i 2021-01-07 22:01

Why is it that when I do range in Haskell, this works:

[LT .. GT]

but this doesn\'t:

[LT..GT]

and what do

3条回答
  •  时光取名叫无心
    2021-01-07 22:38

    Failed to load interface for `LT':

    Kenny and Hammar have explained what this means: LT.. is assumed to be the . function in the LT module. Since there is no LT module, your interpreter naturally cannot load it.

    A section must be enclosed in parentheses thus: (LT.. GT)

    Along the same vein, assuming that LT.. is a reference to the . function in the LT module, your interpreter is apparently assuming that you made the mistake of using square brackets instead of parens in order to for a "section" ( a section is, for example, (+1) ).

    This is simply an obnoxious little wart in the Haskell language; just remember to use spaces.

提交回复
热议问题