[Haskell-cafe] Haskell spacing problem.

Frozz dj_frozz at hotmail.com
Fri Mar 9 06:05:56 EST 2007

Hi Haskell ppl,

I'm trying to solve a problem that had been bothering me for a long time. I'm 
trying to create index and display the index in Hugs as well as an output text 

Below is my code. In Hugs, the index managed to get displayed well with nice 
alignments. However, for the text file, the alignment is off. The bracket with 
the numbers are messy. I really don't know why this would happen.

Desired output:

Anna   [1]
Ben    [2]
Shane  [3]

dispTable :: [([Int], Word)] -> String
dispTable = unlines . map (\ (num,word) -> word ++ 
        take (25 - (length word)) (repeat ' ')    ++ show num)

Did i do sth wrong? Thanks in advance.

More information about the Haskell-Cafe mailing list