> 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:
>
> fix :: (a -> a) -> a -- usual fixed-points
> fix f = let a = f a in a
>
> nthApprox :: Integer -> (a -> a) -> a --
> approximations to fix
> nthApprox n f = (iterate f undefined) !! n
>
> trace :: ((a, u) -> (b, u)) -> (a, b) -- traces
> trace f a = let (b, u) in f (a, u) in b
>
> pFix :: ((a, u) -> u) -> (a -> u) -- parameterized fix
> pFix f a = let (a, u) = f u in u
>
> Then MonadRec, Arrow, or whoever just needs fixed-point operators
> 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