18 lines
448 B
Haskell
18 lines
448 B
Haskell
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 ++ ")"
|