fix: tests
This commit is contained in:
parent
18921e06d1
commit
ca81f3b0f2
@ -10,7 +10,7 @@ import Data.Aeson
|
||||
import Data.Aeson.Encoding.Internal
|
||||
import Data.Aeson.Types (parseMaybe)
|
||||
import Data.Proxy
|
||||
import Unsafe.Coerce -- DON'T PANIC, it's aeson's fault
|
||||
import Data.Coerce
|
||||
|
||||
jsonKeyLaws :: forall a. (Arbitrary a, FromJSONKey a, ToJSONKey a, Eq a, Show a, FromJSON a, ToJSON a) => Proxy a -> Laws
|
||||
jsonKeyLaws _ = Laws "ToJSONKey/FromJSONKey"
|
||||
@ -26,8 +26,8 @@ jsonKeyLaws _ = Laws "ToJSONKey/FromJSONKey"
|
||||
where
|
||||
partialIsomorphism :: forall a'. (FromJSONKey a', ToJSONKey a', Eq a') => a' -> Property
|
||||
partialIsomorphism a = case (toJSONKey, fromJSONKey) of
|
||||
(ToJSONKeyText toVal _, FromJSONKeyCoerce _)
|
||||
-> property $ unsafeCoerce (toVal a) == a
|
||||
(ToJSONKeyText toVal _, FromJSONKeyCoerce)
|
||||
-> property $ coerce (toVal a) == a
|
||||
(ToJSONKeyText toVal _, FromJSONKeyText fromVal)
|
||||
-> property $ fromVal (toVal a) == a
|
||||
(ToJSONKeyText toVal _, FromJSONKeyTextParser parser)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user