[Haskell-cafe] trace output statements
Damien Mattei
damien.mattei at gmail.com
Sun Dec 23 15:44:57 UTC 2018
i will spent part of my christmas holidays, learning seriously
Haskell...fonctor,monads,IO....
i hope next year i will ask less silly question ;-) in the haskell-cafe
mailing list.
For now i'm sticked with problems with IO Monads,database IO, and i have to
revamp all my code because it's not working as i want, having code in main
is ok but if i put some part of code in a simple function it fails to
compile or worse compile but ouput nothing or give/require me /back IO *
things that are a nightmare to deal with...
i must admit i never has such difficulty learning a language... i think
learning Monads from scratch again will help me, the frustrating part of
all this is that i'm only trying to do database manipulation that would be
easy in python or Scheme.
I do not want to blame myself more, i think that Haskell is too abstract
for basic things such as IO, it's ok to be abstract for hard problems,C++
with standart template library for example but not for reading an input
from a database and manipulate the data simply...
On Sun, Dec 23, 2018 at 4:11 PM Tom Ellis <
tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk> wrote:
> 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
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20181223/eb761689/attachment.html>
More information about the Haskell-Cafe
mailing list