Fix more item bugs

This commit is contained in:
2025-08-24 23:50:16 +01:00
parent c2daa86463
commit d776c91cfd
9 changed files with 113 additions and 99 deletions
+14 -3
View File
@@ -1,6 +1,4 @@
module ShortShow (
shortShow,
) where
module ShortShow (shortShow, ShortShow, ShortString (..)) where
import Geometry
import Numeric
@@ -11,9 +9,22 @@ class ShortShow a where
instance ShortShow a => ShortShow (V2 a) where
shortShow (V2 x y) = shortShow x ++ "#" ++ shortShow y
newtype ShortString = SString String
instance ShortShow ShortString where
shortShow (SString x) = show x
instance ShortShow Float where
shortShow x = showFFloat (Just 2) x ""
instance ShortShow Bool where
shortShow True = "T"
shortShow False = "F"
instance ShortShow a => ShortShow (Maybe a) where
shortShow (Just x) = "J#" <> shortShow x
shortShow Nothing = "NTHNG"
instance ShortShow Int where
shortShow x
| x < k' = show x