[Haskell-cafe] Parse text difficulty

Jules Bean jules at jellybean.co.uk
Thu Dec 9 05:31:52 EST 2004


To amplify on the other replies you already had, don't use show here:

> makeIndex :: Doc -> Doc  -- changed so output can be written to file
> makeIndex
>  = show .
>    shorten .    -- [([Int], Word)] -> [([Int], Word)]
>    amalgamate . -- [([Int], Word)] -> [([Int], Word)]
>    makeLists .  -- [(Int, Word)]   -> [([Int], Word)]
>    sortLs .     -- [(Int, Word)]   -> [(Int, Word)]
>    allNumWords . -- [(Int, Line)]   -> [(Int, Word)]
>    numLines .   -- [Line]          -> [(Int, Line)]
>    splitUp     -- Doc             -> [Line]
>

Instead use, e.g.

printastable :: [([Int],Word)] -> String

printastable l = concat $ map (\(xs,w) -> (show xs) ++ " " ++ w ++ 
"\n") l

Jules



More information about the Haskell-Cafe mailing list