shortLinesOnly :: IO ()
shortLinesOnly = interact result
where
shortLength = 11
onlyShorts = (<= shortLength) . length
shortLines = filter onlyShorts . lines
result = unlines . shortLines
interact result = getContents >>= putStr . result
In the above code how can I write the interact function in point free style.
Step by step:
interact r = getContents >>= putStr . r
interact r = (getContents >>=) (putStr . r)
interact r = (getContents >>=) $ (putStr .) $ r
interact = (getContents >>=) . (putStr .)