Commits

Bryan O'Sullivan committed 7b97a5f

Make Value an instance of IsString

Requested by Bas van Dijk.

Comments (0)

Files changed (1)

 import Data.Map (Map)
 import Data.Monoid (Dual(..), First(..), Last(..))
 import Data.Ratio (Ratio)
+import Data.String (IsString(..))
 import Data.Text (Text, pack, unpack)
 import Data.Text.Encoding (decodeUtf8, encodeUtf8)
 import Data.Time.Clock (UTCTime)
     rnf (Bool b)   = rnf b
     rnf Null       = ()
 
+instance IsString Value where
+    fromString = String . pack
+    {-# INLINE fromString #-}
+
 -- | The empty array.
 emptyArray :: Value
 emptyArray = Array V.empty