{-# OPTIONS_GHC -fno-warn-orphans #-} module Data.Validity.Persist where import Data.Validity import Database.Persist instance Validity (Key a) where validate :: Key a -> Validation validate = Key a -> Validation forall a. a -> Validation trivialValidation instance Validity a => Validity (Entity a) where validate :: Entity a -> Validation validate Entity a e = [Validation] -> Validation forall a. Monoid a => [a] -> a mconcat [String -> Key a -> Validation forall a. Validity a => String -> a -> Validation delve String "entityKey" (Key a -> Validation) -> Key a -> Validation forall a b. (a -> b) -> a -> b $ Entity a -> Key a forall record. Entity record -> Key record entityKey Entity a e, String -> a -> Validation forall a. Validity a => String -> a -> Validation delve String "entityVal" (a -> Validation) -> a -> Validation forall a b. (a -> b) -> a -> b $ Entity a -> a forall record. Entity record -> record entityVal Entity a e]