FW: MonadFix

Simon Marlow simonmar@microsoft.com
Mon, 25 Feb 2002 10:42:52 -0000


> Why don't we put "fix" into another library, and let MonadRec
> Arrow, etc. import it? Fixed-point operators show up quite often
> to deserve a library of their own: If all I care about is
> "fix", I shouldn't be forced to "import MonadRec". This new
> library can include various flavors of fix:
>=20
>    fix :: (a -> a) -> a                        -- usual fixed-points
>    fix f =3D let a =3D f a in a   =20
>=20
>    nthApprox :: Integer -> (a -> a) -> a       --=20
> approximations to fix
>    nthApprox n f =3D (iterate f undefined) !! n=20
>              =20
>    trace :: ((a, u) -> (b, u)) -> (a, b)       -- traces
>    trace f a =3D let (b, u) in f (a, u) in b   =20
>=20
>    pFix :: ((a, u) -> u) -> (a -> u)           -- parameterized fix
>    pFix f a =3D let (a, u) =3D f u in u
>   =20
> Then MonadRec, Arrow, or whoever just needs fixed-point operators=20
> can import it from there..

This sounds fine to me.  It should probably go in Control.Fix.  Levent: =
would you like to suggest a full contents for this library?

Cheers,
	Simon