File: Eq.hs

package info (click to toggle)
haskell-generics-sop 0.5.1.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 232 kB
  • sloc: haskell: 1,846; sh: 22; makefile: 4
file content (20 lines) | stat: -rw-r--r-- 399 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MonoLocalBinds #-}
module SOPBench.Eq where

import Generics.SOP

geq :: (Generic a, All2 Eq (Code a)) => a -> a -> Bool
geq x y =
  eq' (from x) (from y)

eq' :: All2 Eq xss => SOP I xss -> SOP I xss -> Bool
eq' =
  ccompare_SOP
    peq
    False
    (\ x y -> and (hcollapse (hczipWith peq (mapIIK (==)) x y)))
    False

peq :: Proxy Eq
peq = Proxy