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
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
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
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
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
: 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
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
>
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
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
> 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
--
>
> > -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
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
12 matches
Mail list logo