Haskell 根据值的范围筛选列表元素

Haskell 根据值的范围筛选列表元素,haskell,Haskell,我宣布了一份清单: lst = [-1,6,4,13] 我想过滤值大于0小于10的列表元素。我写道: filterList :: [Int] -> [Int] filterList lst = filter (>0 && <10) lst 但当我运行编译器时,显示的错误是由于“ filterList lst=filter(>0&您可以使用列表理解 [x | x <- lst, x<10, x>0] [x | x 0)lst) 因此“x”在

我宣布了一份清单:

lst = [-1,6,4,13]
我想过滤值大于0小于10的列表元素。我写道:

filterList :: [Int] -> [Int]
filterList lst = filter (>0 && <10) lst
但当我运行编译器时,显示的错误是由于“
filterList lst=filter(>0&您可以使用列表理解

[x | x <- lst, x<10, x>0]
[x | x 0)lst)

因此“x”在lambda表达式中是必需的。@Maxxx那么,您可以用无点样式将其编写为
filter(&&)(>0)(0)(
filterList lst = filter ((>0) && (<10)) lst -- no parse errors, but types are not matched
filterList lst = filter (\x -> (x > 0) && (x < 10)) lst
[x | x <- lst, x<10, x>0]
filter (< 10) (filter (> 0) lst)