From 11fca081b1241e1915f357fa40baa3e97aceb823 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Sat, 3 Dec 2022 01:03:52 -0700 Subject: 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. --- Graphics/Glyph/Util.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Graphics/Glyph/Util.hs') 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 -- cgit