make () to OBJECT instance (Nil)

This commit is contained in:
Hideyuki Tanaka 2010-05-04 16:24:45 +09:00
parent 674c26d9c7
commit dbe760d6e2

View File

@ -46,6 +46,11 @@ instance OBJECT Object where
fromObjectError :: String
fromObjectError = "fromObject: cannot cast"
instance OBJECT () where
toObject = const ObjectNil
fromObject ObjectNil = Right ()
fromObject _ = Left fromObjectError
instance OBJECT Int where
toObject = ObjectInteger
fromObject (ObjectInteger n) = Right n