[Haskell-beginners] Does haskell have to have values?
es at ertes.de
Sun Mar 27 03:02:32 CEST 2011
Mike Meyer <mwm at mired.org> wrote:
> So the question is - is there any advantage or harm in this way of
> looking at values?
One harm is that you are mixing two concepts, which Haskell specifically
tries to keep separate: functions and procedures. A function maps a
value to another value. A "zeroadic function" hence is not a function.
It is indeed a value and the thunk concept is just a technical detail,
about which you shouldn't bother. You can write proper Haskell programs
without ever knowing, what a thunk is or how lazy evaluation is
Now in most strict languages there are no real functions, and procedures
are just named "functions" for some reason. In my opinion the "zeroadic
function" view is going to hurt you much more than it is going to help
you. Brent makes a good point that it may help you, when coming from a
strict language, but on the other hand understanding lazy evaluation,
non-strictness and forcing will make Haskell much more natural to you.
With zeroadic "functions" you may end up not writing natural Haskell
programs, but just trying to fit your strict view into the non-strict,
lazily evaluated world.
nightmare = unsafePerformIO (getWrongWife >>= sex)
More information about the Beginners