`show' in ghci dialogue
Serge D. Mechveliani
mechvel at botik.ru
Sat Jan 12 08:40:16 EST 2008
On Sat, Jan 12, 2008 at 01:11:00PM +0000, Neil Mitchell wrote:
> Hi Serge,
>
> I think what you are looking for is putStr:
>
> ghci> putStr "Test\nhere"
> Test
> here
Thank you.
And my `main' function below did apply putStr.
I am sorry, I got confused: cannot recall in what situation its
output was
"[([1, 2, 3), []),\n\n([4, 5, 6), [7]),\n\n([9, 8, 0],\n\n[0, 0, 0])]"
How strange ...
> On 1/12/08, Serge D. Mechveliani <mechvel at botik.ru> wrote:
> > [..]
> > ---------------------------
> > class DShow a where dShow :: ShowOptions -> a -> String
> > ...
> > main = let listOfListPairs = [ ([1,2,3], [] ),
> > ([4,5,6], [7] ),
> > ([9,8,0], [0,0,0])
> > ] :: [ ([Int], [Int]) ]
> > opts = ShowOptions {verbosity = 2,
> > listSepator = ", \n\n",
> > fieldSeparator = ", \n"}
> > in
> > putStr (dShow opts listOfListPairs)
> > ---------------------------
> >
> > Then, the command ./Main outputs
> >
> > -----------------------
> > [([1, 2, 3], []),
> >
> > ([4, 5, 6], [7]),
> >
> > ([9, 8, 0], [0, 0, 0])]
> > -----------------------
> > [..]
> > But the command
> >
> > > main
> >
> > in the ghci interpreter outputs something like this:
> > "[([1, 2, 3), []),\n\n([4, 5, 6), [7]),\n\n([9, 8, 0],\n\n[0, 0, 0])]"
> >
> > [..]
More information about the Glasgow-haskell-users
mailing list