[Haskell-cafe] Overriding a Prelude function?

Claus Reinke claus.reinke at talk21.com
Thu Apr 23 15:07:06 EDT 2009

> *Main> :t rollDie ~>> (rollDie ~>> rollDie)
> rollDie ~>> (rollDie ~>> rollDie) :: Seed -> (Int, Seed)
> This is a function. How exactly do you want ghci to show it? When you 
> figure that out, feel free to make an instance of Show for it.

Just because user programs can't show function internals (they can
show parts of in/out tables, and with sufficient overloading they can
even show approximations of representation) that does not mean
that the language implementation can't show function internals.

That is a feature that I've always missed in Haskell implementations.

In the reduction systems I used before Haskell, one could enter a
function, reduce it (stepwise, or to whnf, or even to hnf) and get
the resulting function back in the editor, ready for inspection, editing,
application, and further reduction. That kind of feature needs to be 
designed into the implementation early on, but it gives a whole new 
dimension to "programming with functions" (I recall how difficult it
was for the designers and implementers of those reduction systems
to explain that difference to reviewers).


PS. and, yes, before anyone suspects otherwise, those reduction
    systems did compiled graph reduction - they just didn't expose
    users to all those low-level details. 

More information about the Haskell-Cafe mailing list