[Haskell-cafe] Overriding a Prelude function?
Luke Palmer
lrpalmer at gmail.com
Thu Apr 23 15:50:55 EDT 2009
On Thu, Apr 23, 2009 at 1:34 PM, Miguel Mitrofanov <miguelimo38 at yandex.ru>wrote:
>
> Well, than, what would you expect from this:
>
> let {f x = g x;
> g 0 = 0;
> g n = f (n-1)}
> in show f
Well, not show, because any show instance for functions breaks r.t. But the
interactive interpreter, if it is not subject to r.t., might show:
let { f x = g x;
g 0 = 0;
g n = f (n-1) } in f
Or
fst (fix (\~(f,g) -> (\x -> g x, \n -> case n of { 0 -> 0; n -> f (n-1) })))
Or any number of other equivalent writings.
Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090423/24c2ae40/attachment.htm
More information about the Haskell-Cafe
mailing list