Browse files

Instance for Maybe as per #4

  • Loading branch information...
1 parent fe9316e commit 358d7d94db88e159c220da773b021fe3d6dfe90d @singpolyma singpolyma committed Oct 13, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 Data/Text/Buildable.hs
View
6 Data/Text/Buildable.hs
@@ -16,6 +16,7 @@ module Data.Text.Buildable
Buildable(..)
) where
+import Data.Monoid (mempty)
import Data.Int (Int8, Int16, Int32, Int64)
import Data.Ratio (Ratio, denominator, numerator)
import Data.Text.Format.Functions ((<>))
@@ -139,6 +140,11 @@ instance (Show a) => Buildable (Shown a) where
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 #-}

0 comments on commit 358d7d9

Please sign in to comment.