[Haskell-cafe] Re: Parse text difficulty
Ferenc Wagner
wferi at afavant.elte.hu
Thu Dec 9 05:45:03 EST 2004
Douglas Bromley <doug.bromley at gmail.com> writes:
> I've show(n) a particular data type and it shows up as:
> [([2,6],"British"),([1],"Charles"),([1,8],"Clarke"),([2,6],"Council"),([2],"Edinburgh"),([1],"Education"),([4],"Increasingly")]
>
> What I want to do is format that nicely into a table.
> Which would give:
> [2,6],"British"
> [1],"Charles"
> [1,8],"Clarke"
> [2,6],"Council"
> ......etc
>
> makeIndex
> = show .
> shorten . -- [([Int], Word)] -> [([Int], Word)]
I'd use
unlines . map (\(f,s)->shows f (',':s))
instead of show; it also gets rid of the quotation marks.
--
Cheers,
Feri.
More information about the Haskell-Cafe
mailing list