converter for Maybe type
This commit is contained in:
parent
3c0b57db7c
commit
34599280f5
1 changed files with 6 additions and 0 deletions
|
@ -567,3 +567,9 @@ instance BsonConv [BsonDoc] where
|
|||
toBson = BsonArray . List.map toBson
|
||||
fromBson (BsonArray ss) = List.map fromBson ss
|
||||
fromBson _ = throwUnsupConv
|
||||
|
||||
instance (BsonConv a) => BsonConv (Maybe a) where
|
||||
toBson Nothing = BsonNull
|
||||
toBson (Just a) = toBson a
|
||||
fromBson BsonNull = Nothing
|
||||
fromBson a = Just $ fromBson a
|
||||
|
|
Loading…
Reference in a new issue