{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Data.Row.Hashable where

import Data.Hashable

import Data.Row
import Data.Row.Records qualified as Rec

instance (Forall r Hashable, Forall r Eq) => Hashable (Rec r) where
  hashWithSalt :: Int -> Rec r -> Int
hashWithSalt Int
s Rec r
record = Int -> [Int] -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s (forall (c :: * -> Constraint) (ρ :: Row (*)) b.
Forall ρ c =>
(forall a. c a => a -> b) -> Rec ρ -> [b]
Rec.erase @Hashable (Int -> a -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s) Rec r
record)