Commits

Bryan O'Sullivan  committed c210374 Merge

Merge pull request #6 from singpolyma/master

Instances for Maybe and Bool

  • Participants
  • Parent commits 8061b0d, a668e1a

Comments (0)

Files changed (1)

File Data/Text/Buildable.hs

       Buildable(..)
     ) where
 
+import Data.Monoid (mempty)
 import Data.Int (Int8, Int16, Int32, Int64)
 import Data.Ratio (Ratio, denominator, numerator)
 import Data.Text.Format.Functions ((<>))
     build = fromString . show . shown
     {-# INLINE build #-}
 
+instance (Buildable a) => Buildable (Maybe a) where
+    build Nothing = mempty
+    build (Just v) = build v
+    {-# INLINE build #-}
+
 instance Buildable TimeOfDay where
     build = build . Shown
     {-# INLINE build #-}
 
 instance Buildable (Ptr a) where
     build = build . ptrToWordPtr
+
+instance Buildable Bool where
+    build True = fromText "True"
+    build False = fromText "False"