haskell can not construct infinite type
问题 I'm new to haskell. I wrote a simple code. But it does not work. I'm getting this 'can not construct infinite type' error. How does it fix. reverse' list | null list = [] | otherwise = (reverse' (tail list)) : (head list) 回答1: The problem arises from your use of the : operator, which has the type (:) :: a -> [a] -> [a] So it takes an element and a list, and returns a new list with that element prepended on. Where you have reverse' (tail list) : head list -- parentheses removed since they're