Why is the code below not working- it is not giving the desired output.I want it to sort a string(e.g cba -> abc ) .After I signal end of file with
^D i just get: cba .
import System.IO (isEOF)
interact (concat . sort .lines)
Looks like you want something more like:
import Data.List main = interact (unlines . map sort . lines)
This sorts each line entered.