module Test.QuickCheck.Classes.PersistField
  ( persistFieldLaws
  ) where

import ClassyPrelude
import Test.QuickCheck
import Test.QuickCheck.Classes
import Database.Persist
import Data.Proxy

persistFieldLaws :: forall a. (Arbitrary a, PersistField a, Eq a, Show a) => Proxy a -> Laws
persistFieldLaws _ = Laws "PersistField"
  [ ("Partial Isomorphism", property $ \(a :: a) -> fromPersistValue (toPersistValue a) == Right a)
  ]
