Haskell Problem
Hannah Schroeter
uk1o@rz.uni-karlsruhe.de
Tue, 10 Oct 2000 23:36:11 +0200
Hello!
On Tue, Oct 10, 2000 at 07:11:14PM +0100, Graeme Turner wrote:
> [...]
> I am e-mailing you to see if you could offer me a bit of assistance. I have
> chosen to use
> Haskell in a minor assignment at my University, Heriot Watt in Edinburgh.
> The basic aim is to read in a file of data, sort it and then display it.
> [...]
How about
import List(sort)
main = do
fileContents <- readFile "inputFile"
-- the do notation hides the bind (>>=) operator.
-- fileContents :: String (=== [Char])
let l = lines fileContents
-- l :: [String]
let sortedL = sort l
-- sortedL :: [String]
let outputData = unlines sortedL
-- outputData :: String
putStr outputData
Regards, Hannah.