{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# 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 = 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 (forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s) Rec r
record)