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 /Data/ByteStringBuilder.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 'Data/ByteStringBuilder.hs')
-rw-r--r-- | Data/ByteStringBuilder.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Data/ByteStringBuilder.hs b/Data/ByteStringBuilder.hs index 859d710..6f0222e 100644 --- a/Data/ByteStringBuilder.hs +++ b/Data/ByteStringBuilder.hs @@ -25,8 +25,18 @@ putB = put . BSL.singleton runBuilder :: Builder -> ByteString runBuilder (ByteStringBuilder bs _) = bs +instance Functor ByteStringBuilder where + fmap f bb = bb >>= (return . f) + +instance Applicative ByteStringBuilder where + (<*>) afn aa = do + fn <- afn + a <- aa + return (fn a) + + pure = return + instance Monad ByteStringBuilder where ByteStringBuilder a _ >> ByteStringBuilder b c = ByteStringBuilder (a `append` b) c a@(ByteStringBuilder _ b) >>= func = a >> func b return = ByteStringBuilder BSL.empty - fail = error |