From 525f45efeb57ee8ff495800d187f5ac01082a50d Mon Sep 17 00:00:00 2001 From: justin Date: Wed, 25 May 2022 20:25:29 +0100 Subject: [PATCH] Add file --- src/ShortShow.hs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/ShortShow.hs diff --git a/src/ShortShow.hs b/src/ShortShow.hs new file mode 100644 index 000000000..10da46b37 --- /dev/null +++ b/src/ShortShow.hs @@ -0,0 +1,17 @@ +module ShortShow where +import Geometry + +--import Data.Typeable +import Numeric + +class ShortShow a where + shortShow :: a -> String + +instance ShortShow a => ShortShow (V2 a) where + shortShow (V2 x y) = shortShow x ++ "#" ++ shortShow y + +instance ShortShow Float where + shortShow x = showFFloat (Just 2) x "" + +instance (ShortShow a,ShortShow b) => ShortShow (a,b) where + shortShow (a,b) = '(' : shortShow a ++ "," ++ shortShow b ++ ")"