[Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-19 Thread Gregory Guthrie
I am pretty new to Haskell, so need some clarification. I am porting some code from SML, and getting a result that surprises me. I basically have some functions which work like this: f1 = fa fb fc test1 = do print "test1:" f1 But I ran a few tests, and got odd re

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-19 Thread Daniel Fischer
On Tuesday 19 April 2011 21:10:09, Gregory Guthrie wrote: > I am pretty new to Haskell, so need some clarification. > I am porting some code from SML, and getting a result that surprises me. > > I basically have some functions which work like this: > f1 = fa fb fc > test1 = do print "test

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-19 Thread Felipe Almeida Lessa
On Tue, Apr 19, 2011 at 4:10 PM, Gregory Guthrie wrote: > and I get different results from the two executions (f1,f2), even though > they have exactly the same definition. Reversing their order, gives the > exact same results (i.e. the results are still different, and in the same > original order

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-19 Thread Jake McArthur
You can think of IO actions as values (which don't change) representing imperative programs to execute (which may have different results each time you execute them). So, `fa fb fc` represents the exact same value as `fa fb fc`, but if you execute that value multiple times you may get different resu

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-19 Thread Gregory Guthrie
skell.org > Cc: Gregory Guthrie > Subject: Re: [Haskell-cafe] Haskell from SML - referrential Transparency?! > > On Tuesday 19 April 2011 21:10:09, Gregory Guthrie wrote: > > I am pretty new to Haskell, so need some clarification. > > I am porting some code from SML, and gettin

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-19 Thread Gregory Guthrie
: Tuesday, April 19, 2011 2:26 PM > To: Gregory Guthrie > Cc: haskell-cafe@haskell.org > Subject: Re: [Haskell-cafe] Haskell from SML - referrential Transparency?! > > On Tue, Apr 19, 2011 at 4:10 PM, Gregory Guthrie wrote: > > and I get different results from the two executions

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-19 Thread Luke Palmer
ator, should we expect that f1 = f1 >> f1? Luke > > --- > > -Original Message- > > From: Felipe Almeida Lessa [mailto:felipe.le...@gmail.com] > > Sent: Tuesday, April 19, 2011 2:26 PM > > To: Gregory Guthrie >

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-19 Thread Daniel Fischer
On Tuesday 19 April 2011 21:38:18, Gregory Guthrie wrote: > I did post the code - but don't expect anyone to really wade through and > debug for me! :-) Oh, wow. Haskell looking like Lisp :( > (The issues that I am asking about are a9b, a9bb at > line 435, 438) http://hpaste.org/45851/haskell_fr

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-19 Thread Gregory Guthrie
haskell-cafe@haskell.org > Subject: Re: [Haskell-cafe] Haskell from SML - referrential Transparency?! > > On Tuesday 19 April 2011 21:38:18, Gregory Guthrie wrote: > > I did post the code - but don't expect anyone to really wade through > > and debug for me! :-) > > Oh

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-19 Thread Brandon Moore
> Thanks. > > It was the "no computation needed" difference that I was missing, and was >including (falsely) in my expectations for "same result", i.e. including the >same traces. To be clear, Debug.trace is not referentially transparent. It's only supposed to be used for debugging. Brand

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-25 Thread Ryan Ingram
-- > > > -Original Message- > > From: Daniel Fischer [mailto:daniel.is.fisc...@googlemail.com] > > Sent: Tuesday, April 19, 2011 2:16 PM > > To: haskell-cafe@haskell.org > > Cc: Gregory Guthrie > > Subject: Re: [Haskell-cafe] Haskell from SML - referrenti

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-25 Thread Colin Adams
On 26 April 2011 00:53, Ryan Ingram wrote: > I've been working on Haskell for quite a while and it's not too often that > a beginner shows me a new trick--this trick with trace seems really cool and > I hadn't seen it before. > > f x | trace ("f " ++ show x) False = undefined > f ... -- rest of r