Fix more item bugs
This commit is contained in:
+14
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user