Skip to content

Commit

Permalink
Uses Array.cons to avoid creating a new array
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Solomon committed May 10, 2023
1 parent 84fafa0 commit dba4711
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Deku/Hooks.purs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Control.Alt ((<|>))
import Control.Monad.ST.Class (liftST)
import Control.Monad.ST.Internal as STRef
import Control.Monad.ST.Uncurried (mkSTFn1, mkSTFn2, runSTFn1, runSTFn2)
import Data.Array as Array
import Data.Either (Either(..))
import Data.Foldable (for_)
import Data.Maybe (Maybe(..), fromMaybe)
Expand Down Expand Up @@ -412,7 +413,7 @@ useAffOrDie e f1 f2 = Nut ee
Right a -> do
r' <- launchAff do
f1 a
liftST $ void $ STRef.modify ([ r' ] <> _) r
liftST $ void $ STRef.modify (Array.cons r') r
Left err -> do
arr <- liftST $ STRef.read r
liftST $ void $ STRef.write [] r
Expand Down

0 comments on commit dba4711

Please sign in to comment.