Closed
Description
I believe this should be equivalent to the MonadFix
instance for []
:
instance MonadFix Vector where
mfix f
| V.null v0 = V.empty
| otherwise = v
where
v = V.generate (V.length v0)
(\i -> if i == 0
then V.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.
Metadata
Metadata
Assignees
Labels
No labels