[Haskell-cafe] trace output statements

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Sun Dec 23 15:11:28 UTC 2018


Yes, exactly!

On Sun, Dec 23, 2018 at 02:08:57PM +0100, Damien Mattei wrote:
> lazyness....?
> 
> On Sun, Dec 23, 2018 at 8:40 AM Tom Ellis <
> tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk> wrote:
> 
> > On Sat, Dec 22, 2018 at 09:52:18AM +0100, Damien Mattei wrote:
> > > i have inserted trace statement that output variable
> > > ... i have strange behavior of output:
> >
> > Let's take a simpler example.  Do you understand why the trace statments
> > from this small program appear in the order that they do?  (And for what
> > it's worth I really think you'll be better off writing programs using do
> > notation).
> >
> >
> > % cat test.hs
> > import Debug.Trace
> >
> > result =
> >   let a = trace "evaluating a" 2
> >       b = trace "evaluating b" 10
> >       c = trace "evaluating c" (a + b)
> >   in c
> > ~% ghci -e result test.hs
> > evaluating c
> > evaluating b
> > evaluating a
> > 12


More information about the Haskell-Cafe mailing list