prelude> let lol [] = []
defines a type function [a] -> [b]that will cause the pattern to fail when passing a non-empty list. This definition is then obscured.
prelude> let lol (x:xs) = (lol xs) ++ [x]
type [a] -> [a], which will cause the template to crash when its argument is empty.
let the bindings are not incremental, the new binding for the name obscures the old binding.
You can define a function with multiple sentences by separating sentences with a semicolon,
let lol [] = []; lol (x:xs) = lol xs ++ [x]
source
share