Hi Henning, On Dec 18, 2007 3:53 PM, Henning Thielemann <[EMAIL PROTECTED]> wrote: > Since this was discussed already here, I summed it up in: > http://www.haskell.org/haskellwiki/Show_instance_for_functions
I find the discussion under "theoretical answer" unsatisfying. The property that a Show instance for functions would break is extensionality, and while extensionality is a desirable trait and matches the common mathematical intuitions, a system with intensional functions certainly isn't "unmathematical" or impure. Further, even with extensionality, we can (with compiler support) in principle have Show instances other than enumerating the graph. At least for simple non-recursive functions, showing the Böhm tree of the function could be useful (except that you loop forever if you encounter bottom somewhere, of course, instead of printing "bottom" as you would if you could print the actual Böhm tree). For example, id would be shown as "\a -> a," maybe would be shown as "\a b c -> case c of { Just d -> b d; Nothing -> a }," and all would be shown as "\a -> case a of { (b:c) -> case b of { False -> False; True -> case c of { (d:e) -> case d of { False -> False" et cetera ad infinitum. Of course, for functions on ints this would indeed reduce to enumerating the graph, printed as an infinite case expression. - Benja _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe