I believe this should be equivalent to the MonadFix instance for []:
instanceMonadFixVectorwhere
mfix f
|V.null v0 =V.empty
|otherwise= v
where
v =V.generate (V.length v0)
(\i ->if i ==0thenV.head v0
else f (v ! i) ! i)
v0 = fix (f .V.head)
Of course, that generate can be replaced with something slightly more efficient, but I don't know if it's worth the trouble.
I believe this should be equivalent to the
MonadFixinstance for[]:Of course, that
generatecan be replaced with something slightly more efficient, but I don't know if it's worth the trouble.