concept input in category haskell

appears as: inputs, input, input, n input, The input
Get Programming with Haskell

This is an excerpt from Manning's book Get Programming with Haskell.

One thing that might strike you as odd about this function is that the order of your arguments isn’t the same as the order you use them or that they appear in the URL itself. Anytime you might want to use a closure (which in Haskell is pretty much anytime), you want to order your arguments from most to least general. In this case, each host can have multiple API keys, each API key is going to use different resources, and each resource is going to have many IDs associated with it. The same is true when you define ifEven; the function you pass will work with a huge range of inputs, so it’s more general and should appear first in the argument list.

Listing 24.10. main with the evaluation bugs fixed
main :: IO () main = do args <- getArgs let fileName = head args file <- openFile fileName ReadMode input <- hGetContents file #1 let summary = (countsText . getCounts) input #2 putStrLn summary #3 hClose file #4 appendFile "stats.dat" (mconcat [fileName, " ",summary, "\n"]) #5 #1 input still hasn’t been evaluated yet. #2 Even though summary is defined, it hasn’t been used. Neither summary nor input have been evaluated. #3 putStrLn needs to print summary; this forces summary to be evaluated, and thus the input to be read in so it can be used by summary. #4 Now closing the file causes no problem because the value inside summary has been evaluated. #5 Appending the file works as expected; your file will be updated correctly. !@%STYLE%@! {"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":5,\"ch\":69},{\"line\":5,\"ch\":71}],[{\"line\":11,\"ch\":0},{\"line\":11,\"ch\":2}],[{\"line\":6,\"ch\":69},{\"line\":6,\"ch\":71}],[{\"line\":12,\"ch\":0},{\"line\":12,\"ch\":2}],[{\"line\":7,\"ch\":69},{\"line\":7,\"ch\":71}],[{\"line\":13,\"ch\":0},{\"line\":13,\"ch\":2}],[{\"line\":8,\"ch\":69},{\"line\":8,\"ch\":71}],[{\"line\":14,\"ch\":0},{\"line\":14,\"ch\":2}],[{\"line\":9,\"ch\":69},{\"line\":9,\"ch\":71}],[{\"line\":15,\"ch\":0},{\"line\":15,\"ch\":2}]]"} !@%STYLE%@!

You’ll start with a UArray that you want to sort. You’ll use the listArray function that’s similar to the listToUArry function you wrote, but also takes a pair of bounds as input.