[Haskell-cafe] If you'd design a Haskell-like language, what would you do different?

Heinrich Apfelmus apfelmus at quantentunnel.de
Fri Mar 9 14:12:27 CET 2012


Jerzy Karczmarczuk wrote:
> Well...
> Personally I hate thinking about bottom as "value". I don't do this. I
> NEVER teach that. And, I am a "lazy guy", almost all my Haskell programs
> are strongly based on laziness.
> 
> I'll tell you what I teach, and you might throw some tomatoes...
> "The fundamental thing that differentiates Haskell from other languages
> and the source of it power" - if I might cite you - is that we don't see
> the difference between an object and the process which creates it.  (The
> difference demands that we speak about the call-by-need, etc...)
> The bottom, as sin (2*pi), or "Text" may be seen as processes. Anyway, a
> lazy list IS a process /par excellence/. The _|_ entity is a process
> which refuses to give you a value (or does it in a deadly way). Your
> program manipulates processes. A process in some computational context
> must do something - or not. The bottom never does anything useful.

While it's ultimately an issue of nomenclature, applying the terminus 
"value" to _|_ is a good idea, because it allows us to answer questions 
like the following:

Question: What is (the denotation of, the value of)

    x = and $ take 5 $ cycle [True,False]
        where cycle xs = fix (xs++)

Answer:

    x = False

If you treat _|_ as a value, this answer can be obtained by 
straightforward algebraic manipulation. If you treat _|_ as an 
operational construct, you will have to perform graph reduction to see 
the answer, but then you have to worry about the *order* in which you 
perform your reduction steps.

It's not wrong to perform graph reduction, and any student should do it 
at one point in their lives, but the restriction to operational 
semantics would miss an important abstraction that is part of the 
Haskell spirit.


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com




More information about the Haskell-Cafe mailing list