FW: MonadFix
Ross Paterson
ross@soi.city.ac.uk
Mon, 4 Mar 2002 11:34:00 +0000
On Sun, Mar 03, 2002 at 11:38:44PM +0000, Levent Erkok wrote:
> On Monday 25 February 2002 10:42 am, Simon Marlow wrote:
> > This sounds fine to me. It should probably go in Control.Fix. Levent:
> > would you like to suggest a full contents for this library?
>
> Sorry for the late reply. Modulo names, I think the attached library
> should do it.
I'd suggest that traceFix be renamed trace; it will be used by
Control.Arrow. But is anyone ever going to use nthFix or paramFix? The
former is only useful in proofs, while the latter is easily available as
paramFix :: ((a, u) -> u) -> a -> u
paramFix f a = fix (curry f a)
How about a Control.Function module, with fix, trace and
compose :: [a -> a] -> a -> a
compose = foldr (.) id
times :: Integral n => n -> (a -> a) -> a -> a
times n f = compose (genericReplicate n f)
so then nthFix n f = times n f undefined. Maybe some of the prelude
functions would belong in there too.