Improve tesla weapon path

This commit is contained in:
2022-03-23 09:48:32 +00:00
parent 7f174b7d18
commit 5a579951c8
10 changed files with 146 additions and 103 deletions
+9
View File
@@ -25,3 +25,12 @@ iterateUntil t m = do
iterateWhile :: Monad m => (a -> Bool) -> m a -> m a
iterateWhile t = iterateUntil (not . t)
unfoldrMID :: (Monad m) => (a -> m (Maybe a)) -> a -> m [a]
unfoldrMID f = go
where
go z = do
x <- f z
case x of
Nothing -> return [z]
Just y -> (z :) <$> go y