rewire-base-2.8: A Haskell-to-Verilog/VHDL compiler, shared base utilities
Safe HaskellSafe
LanguageHaskell2010

ReWire.Fix

Synopsis

Documentation

fix :: (MonadError AstError m, Hashable a) => Text -> Natural -> (a -> m a) -> a -> m a Source #

fix' :: Hashable a => (a -> a) -> a -> a Source #

fixOn :: (MonadError AstError m, Eq b) => (a -> b) -> Text -> Natural -> (a -> m a) -> a -> m a Source #

boundedFixOn :: MonadError AstError m => (a -> a -> Bool) -> Text -> Natural -> (a -> m a) -> a -> m a Source #

Note: evaluates `(f a)` at least once if the bound is not reached.

fixOn' :: Eq b => (a -> b) -> (a -> a) -> a -> a Source #

Note: the recursive call must reuse the already-forced f a -- passing the expression f a itself builds an unshared thunk chain that gets re-evaluated from scratch at every level, making the fixpoint exponential in the iteration count.

fixUntil :: MonadError AstError m => (a -> Bool) -> Text -> Natural -> (a -> m a) -> a -> m a Source #

boundedFix :: Monad m => (a -> a -> Bool) -> Natural -> (a -> m a) -> a -> m a Source #

fixPure :: Eq a => Natural -> (a -> a) -> a -> a Source #

Note: direct equality rather than comparing hashes: equality can stop at the first difference, while hashing always traverses both terms fully.