aboutsummaryrefslogtreecommitdiff
path: root/TileShow.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-12-03 01:03:52 -0700
committerJosh Rahm <joshuarahm@gmail.com>2022-12-03 01:03:52 -0700
commit11fca081b1241e1915f357fa40baa3e97aceb823 (patch)
treec0312c145d9133cef5e31b04a71bec050097f0f0 /TileShow.hs
parent7dd8c59353167e84dab9e7a1afc16e2290b249e3 (diff)
downloadterralloc-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 'TileShow.hs')
-rw-r--r--TileShow.hs27
1 files changed, 0 insertions, 27 deletions
diff --git a/TileShow.hs b/TileShow.hs
deleted file mode 100644
index dd353dc..0000000
--- a/TileShow.hs
+++ /dev/null
@@ -1,27 +0,0 @@
-{-# LANGUAGE TemplateHaskell #-}
-
-module TileShow where
-import Language.Haskell.TH
-
-makeShow t = do
- TyConI (DataD _ _ _ constructors _) <- reify t
- -- Make `show` clause for one constructor:
- -- show (A x1 x2) = "A "++show x1++" "++show x2
- let showClause (NormalC name fields) = do
- -- Name of constructor, i.e. "A". Will become string literal in generated code
- let constructorName = [(head $ nameBase name)]
- -- Generate function clause for one constructor
- clause [conP name []] -- (A x1 x2)
- (normalB [| constructorName |]) [] -- "A "++show x1++" "++show x2
- -- Make body for function `show`:
- -- show (A x1 x2) = "A "++show x1++" "++show x2
- -- show (B x1) = "B "++show x1
- -- show C = "C"
- showbody <- mapM showClause constructors
- -- Generate template instance declaration and then replace
- -- type name (T1) and function body (\x -> "text") with our data
- d <- [d| instance Show String where
- show _x = "text"
- |]
- let [InstanceD [] (AppT showt (ConT _T1)) [FunD showf _text]] = d
- return [InstanceD [] (AppT showt (ConT t )) [FunD showf showbody]]