graphql-engine/server/src-lib/Data/GADT/Compare/Extended.hs
kodiakhq[bot] d8b595575d server: more GHC 9.2 changes compatible with 8.10 (#3550)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4968
GitOrigin-RevId: 1175b2fcc90e0436c99da7fa58d317a49c7704d4
2022-07-07 16:51:18 +00:00

32 lines
704 B
Haskell

{-# LANGUAGE PolyKinds #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.GADT.Compare.Extended
( module Data.GADT.Compare,
strengthenOrdering,
extendGOrdering,
)
where
import "some" Data.GADT.Compare
import Type.Reflection
import Prelude
instance GEq ((:~~:) a) where
geq HRefl HRefl = Just Refl
instance GCompare ((:~~:) a) where
gcompare HRefl HRefl = GEQ
strengthenOrdering :: Ordering -> GOrdering a a
strengthenOrdering LT = GLT
strengthenOrdering EQ = GEQ
strengthenOrdering GT = GGT
infixr 6 `extendGOrdering`
extendGOrdering :: GOrdering a b -> (a ~ b => GOrdering c d) -> GOrdering c d
extendGOrdering GLT _ = GLT
extendGOrdering GEQ x = x
extendGOrdering GGT _ = GGT