File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import Data.Either (Either(..))
1515import Data.Functor ((<$))
1616import Data.Identity (Identity (..), runIdentity )
1717import qualified Control.Monad.Eff.Unsafe as U
18+ import qualified Data.Either.Unsafe as U
1819
1920-- | This type class captures those monads which support tail recursion in constant stack space.
2021-- |
@@ -82,12 +83,10 @@ tailRecEff f a = runST do
8283 writeSTRef r e'
8384 return false
8485 Right b -> return true
85- fromRight <$> readSTRef r
86+ U . fromRight <$> readSTRef r
8687 where
87- f' :: forall h . a -> Eff (st :: ST h | eff ) _
88+ f' :: forall h . a -> Eff (st :: ST h | eff ) ( Either a b )
8889 f' = U.unsafeInterleaveEff <<< f
89- fromRight :: forall a b . Either a b -> b
90- fromRight (Right b ) = b
9190
9291-- | `forever` runs an action indefinitely, using the `MonadRec` instance to
9392-- | ensure constant stack usage.
You can’t perform that action at this time.
0 commit comments