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/ArrayGenerator.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/ArrayGenerator.hs')
-rw-r--r-- | Graphics/Glyph/ArrayGenerator.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Graphics/Glyph/ArrayGenerator.hs b/Graphics/Glyph/ArrayGenerator.hs index 1e9e5a3..16fe41f 100644 --- a/Graphics/Glyph/ArrayGenerator.hs +++ b/Graphics/Glyph/ArrayGenerator.hs @@ -7,6 +7,18 @@ import Data.Array import Data.Maybe data ArrayTransaction ix val b = ArrayBuilderM_ (M.Map ix val) b + +instance (Ord ix) => Functor (ArrayTransaction ix a) where + fmap f bb = bb >>= (return . f) + +instance (Ord ix) => Applicative (ArrayTransaction ix a) where + (<*>) afn aa = do + fn <- afn + a <- aa + return (fn a) + + pure = return + instance (Ord ix) => Monad (ArrayTransaction ix a) where return = ArrayBuilderM_ M.empty (ArrayBuilderM_ map1 val) >>= f = |