Learn You a Haskell presents the shortLines
function:
shortLinesOnly :: String -> String
shortLinesOnly input =
let allLines = lines input
shortLines = filter (\line -> length line < 10) allLines
result = unlines shortLines
in result
From this helpful post, it seems clear to me that the following let ... in
is correct:
> (let x = 2 in x*2) + 3
7
But, in the above shortLinesOnly
example, why is the let
's in
placed at in result
?