I am creating this issue so this TODO item is tracked on GitHub.
This is about preallocation of pairs:
-- | Preallocate two values
--
-- TODO: It would be nice to generalize this, but I can't quite figure out how
-- without introducing a ton of machinery.
preallocatePair :: forall a b r.
(Preallocate a, Preallocate b)
=> (Writing a -> Writing b -> IO r)
-> IO ((a, b), r)
preallocatePair k = fmap reassoc $
preallocate $ \wa ->
preallocate $ \wb ->
k wa wb
where
reassoc :: (a, (b, r)) -> ((a, b), r)
reassoc (a, (b, r)) = ((a, b), r)
I am creating this issue so this TODO item is tracked on GitHub.
This is about preallocation of pairs: