Open EarthCitizen opened 7 years ago
Probably will be />
.
Example implementation for String
:
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ExtendedDefaultRules #-}
import Data.Monoid ((<>))
default (Integer, Float)
class ToString a where
toString :: a -> String
instance ToString Char where
toString = (:[])
instance ToString Integer where
toString = show
instance ToString Float where
toString = show
instance ToString String where
toString = id
infixr 6 />
(/>) :: (ToString a, ToString b) => a -> b -> String
(/>) a b = toString a <> toString b
main = do
print $ "Hello " /> 5 /> " and " /> 7.3 /> " var " /> 'X'
It would be convenient to do something like the following:
FgRed 5 <> " " <> FgWhite 6
New operator?