Permalink
Browse files

Added missing To/FromObject ByteString TextObject instances

  • Loading branch information...
1 parent 8c65b5a commit d8d429e621eb46374c2905c5c8d4a79e064210d6 @snoyberg committed Dec 10, 2009
Showing with 13 additions and 0 deletions.
  1. +13 −0 Data/Object/Text.hs
View
13 Data/Object/Text.hs
@@ -35,6 +35,9 @@ import Data.Typeable (Typeable)
import Control.Exception (Exception)
import Control.Monad ((<=<))
+import qualified Data.ByteString as BS
+import qualified Data.ByteString.Lazy as BL
+
-- | 'Object's with keys and values of type 'LT.Text'.
type TextObject = Object Text Text
instance ToObject Text Text Text where
@@ -83,3 +86,13 @@ instance FromObject Day Text Text where
fromObject = convertAttempt <=< fromScalar
instance FromObject Int Text Text where
fromObject = convertAttempt <=< fromScalar
+
+instance ToObject BL.ByteString Text Text where
+ toObject = Scalar . convertSuccess
+instance FromObject BL.ByteString Text Text where
+ fromObject = fmap convertSuccess . fromScalar
+
+instance ToObject BS.ByteString Text Text where
+ toObject = Scalar . convertSuccess
+instance FromObject BS.ByteString Text Text where
+ fromObject = fmap convertSuccess . fromScalar

0 comments on commit d8d429e

Please sign in to comment.