FW: MonadFix

Levent Erkok erkok@cse.ogi.edu
Mon, 4 Mar 2002 09:40:48 +0000


I agree that nthFix is mainly useful in proofs. Similarly for paramFix. But if we
are having a separate library for "fix"-like functions, I don't see any harm in 
putting them there as well.

The general idea of Control.Function looks good too.

I used the name "traceFix" to avoid clash with the "trace" debugging primitive. It 
sounds too much like a debugging function in any case. 

-Levent.

On Monday 04 March 2002 11:34 am, Ross Paterson wrote:
> 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.