Re: [Haskell-cafe] x -> String

2009-10-18 Thread Matt Morrow
On 10/17/09, Andrew Coppin wrote: > Derek Elkins wrote: >> See vacuum: http://hackage.haskell.org/package/vacuum >> > Could be useful... Thanks! > As Derek mentioned, vacuum would be perfect for this: - import Data.Wo

Re: [Haskell-cafe] x -> String

2009-10-17 Thread Andrew Coppin
Derek Elkins wrote: See vacuum: http://hackage.haskell.org/package/vacuum Could be useful... Thanks! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] x -> String

2009-10-16 Thread Derek Elkins
See vacuum: http://hackage.haskell.org/package/vacuum ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] x -> String

2009-10-16 Thread Ross Mellgren
No problem, just trying to make sure the conversation stays on track :-) -Ross On Oct 16, 2009, at 3:26 PM, Daniel Peebles wrote: Whoops, sorry about that then! On Fri, Oct 16, 2009 at 2:59 PM, Ross Mellgren hask...@z.odi.ac> wrote: Andrew has mentioned the debugger several times, NOT the i

Re: [Haskell-cafe] x -> String

2009-10-16 Thread Daniel Peebles
Whoops, sorry about that then! On Fri, Oct 16, 2009 at 2:59 PM, Ross Mellgren wrote: > Andrew has mentioned the debugger several times, NOT the interactive REPL. > That is, using :-commands to inspect values. > > -Ross > > On Oct 16, 2009, at 2:46 PM, Daniel Peebles wrote: > >> My GHCi can't do t

Fwd: [Haskell-cafe] x -> String

2009-10-16 Thread Alberto G. Corona
yep add Show to your abstrac container. , for example: data SDynamic= forall a.Show a => SDynamic a instance Show SDynamic where show (SDynamic a)= show a 2009/10/16 David Virebayre > On Fri, Oct 16, 2009 at 8:19 PM, Andrew Coppin > wrote: > > Is there any way that you can turn an arbi

Re: [Haskell-cafe] x -> String

2009-10-16 Thread Ross Mellgren
Andrew has mentioned the debugger several times, NOT the interactive REPL. That is, using :-commands to inspect values. -Ross On Oct 16, 2009, at 2:46 PM, Daniel Peebles wrote: My GHCi can't do that :o I just wrote data A = B | C and loaded the file into GHCi. Typing B gives me: :1:0:

Re: [Haskell-cafe] x -> String

2009-10-16 Thread Daniel Peebles
My GHCi can't do that :o I just wrote data A = B | C and loaded the file into GHCi. Typing B gives me: :1:0: No instance for (Show A) arising from a use of `print' at :1:0 Possible fix: add an instance declaration for (Show A) In a stmt of a 'do' expression: print it The error

Re: [Haskell-cafe] x -> String

2009-10-16 Thread Andrew Coppin
Jochem Berndsen wrote: I rephrase: There *is* a way to turn arbitrary values into strings. I know there is, because the GHCi debugger *does* it. The question is, does anybody know of an /easy/ way to do this? No. GHCi does not always do this: Prelude Data.Ratio> let plus1 = (+1) Prelude

Re: [Haskell-cafe] x -> String

2009-10-16 Thread Bulat Ziganshin
Hello Andrew, Friday, October 16, 2009, 10:19:46 PM, you wrote: > actually print out what's in it. On the other hand, I don't want to > alter the entire program to have Show constraints everywhere just so I > can print out some debug traces (and then alter everything back again > afterwards once

Re: [Haskell-cafe] x -> String

2009-10-16 Thread Jochem Berndsen
Andrew Coppin wrote: > Is there any way that you can turn an arbitrary Haskell value into a > string? No, the only values of type a -> String are the constant functions and _|_. > I rephrase: There *is* a way to turn arbitrary values into strings. I > know there is, because the GHCi debugger *doe

Re: [Haskell-cafe] x -> String

2009-10-16 Thread Daniel Peebles
GHCi can't show you functions can it? Unless you have a Show instance for functions loaded. I think the basic answer is no, not even with crazy unsafe stuff, because without the typeclass constraint GHC doesn't know to pass around the secret dictionary containing the methods that tell it how to sho

Re: [Haskell-cafe] x -> String

2009-10-16 Thread Andrew Coppin
David Virebayre wrote: On Fri, Oct 16, 2009 at 8:19 PM, Andrew Coppin wrote: Is there any way that you can turn an arbitrary Haskell value into a string? I rephrase: There *is* a way to turn arbitrary values into strings. I know there is, because the GHCi debugger *does* it. The q

Re: [Haskell-cafe] x -> String

2009-10-16 Thread David Virebayre
On Fri, Oct 16, 2009 at 8:19 PM, Andrew Coppin wrote: > Is there any way that you can turn an arbitrary Haskell value into a string? > I rephrase: There *is* a way to turn arbitrary values into strings. I know > there is, because the GHCi debugger *does* it. The question is, does anybody > know o

[Haskell-cafe] x -> String

2009-10-16 Thread Andrew Coppin
Is there any way that you can turn an arbitrary Haskell value into a string? I rephrase: There *is* a way to turn arbitrary values into strings. I know there is, because the GHCi debugger *does* it. The question is, does anybody know of an /easy/ way to do this? Basically, I'm writing a mutab