[Haskell-cafe] Parse text difficulty

Douglas Bromley doug.bromley at gmail.com
Thu Dec 9 05:39:41 EST 2004


I'd just like to thank everyone for helping.  Its now working great!
I really appreciate your help.  I only wish I'd discovered the mailing
list sooner.

All the best.

Doug


On Thu, 9 Dec 2004 10:31:52 +0000, Jules Bean <jules at jellybean.co.uk> wrote:
> 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