diff options
| author | Josh Rahm <joshuarahm@gmail.com> | 2022-12-03 01:03:52 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-12-03 01:03:52 -0700 |
| commit | 11fca081b1241e1915f357fa40baa3e97aceb823 (patch) | |
| tree | c0312c145d9133cef5e31b04a71bec050097f0f0 /Graphics/Glyph/Util.hs | |
| parent | 7dd8c59353167e84dab9e7a1afc16e2290b249e3 (diff) | |
| download | terralloc-11fca081b1241e1915f357fa40baa3e97aceb823.tar.gz terralloc-11fca081b1241e1915f357fa40baa3e97aceb823.tar.bz2 terralloc-11fca081b1241e1915f357fa40baa3e97aceb823.zip | |
Start reviving this ancient project. (It's pretty cool).
Got it to compile using Stack.
Skybox works, but nothing else really does. I think this is a problem
with how the program is interpreting the surface pixels when
calculating the map terrain and elevation.
I think some TLC is in order.
Diffstat (limited to 'Graphics/Glyph/Util.hs')
| -rw-r--r-- | Graphics/Glyph/Util.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Graphics/Glyph/Util.hs b/Graphics/Glyph/Util.hs index e8a5974..1c1269d 100644 --- a/Graphics/Glyph/Util.hs +++ b/Graphics/Glyph/Util.hs @@ -286,11 +286,20 @@ plusM a = MonadPlusBuilder a () runMonadPlusBuilder :: MonadPlusBuilder a b -> a runMonadPlusBuilder (MonadPlusBuilder !a _) = a +instance (MonadPlus a) => Functor (MonadPlusBuilder (a b)) where + fmap f b = b >>= return . f + +instance (MonadPlus a) => Applicative (MonadPlusBuilder (a b)) where + (<*>) afn aa = do + fn <- afn + fn <$> aa + + pure = return + instance (MonadPlus a) => Monad (MonadPlusBuilder (a b)) where return = MonadPlusBuilder mzero MonadPlusBuilder a1 _ >> MonadPlusBuilder a2 b = MonadPlusBuilder (a1 `mplus` a2) b builder@(MonadPlusBuilder _ b) >>= f = builder >> f b - fail = undefined untilM2 :: (Monad m) => (a -> m Bool) -> a -> (a -> m a) -> m a untilM2 cond ini bod = do |