Created
July 9, 2021 11:20
-
-
Save berberman/afbc5ed5315fac737b506aa4d8d2d319 to your computer and use it in GitHub Desktop.
SYB Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE RankNTypes #-} | |
| module Test where | |
| import Data.Generics | |
| import Data.Void (Void) | |
| myGeq :: forall a. Data a => a -> a -> Bool | |
| myGeq a b = myGeq' a b | |
| where | |
| myGeq' :: GenericQ (GenericQ Bool) | |
| myGeq' x y | |
| | typeOf x == typeOf y, | |
| toConstr x == toConstr y | |
| = and $ gzipWithQ ( | |
| myGeq' | |
| `extQ` impossible | |
| ) x y | |
| | otherwise = False | |
| impossible :: Void -> GenericQ Bool | |
| impossible _ _ = undefined | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment