<commit_before>{-# LANGUAGE FlexibleInstances, GADTs, MultiParamTypeClasses, TypeOperators, TypeSynonymInstances, ViewPatterns #-}

module Data.Type.Equality.Generics where

import Data.Type.Equality
import GHC.Generics
import Unsafe.Coerce (unsafeCoerce)

sameRep' :: (Generic a, Generic b, Rep a ~ D1 d f, Rep b ~ D1 d' f') => Rep a x -> Rep b x -> Maybe (a :~: b)
sameRep' l r = do Refl <- sameRep l r
	       	  return Refl

sameRep :: (Datatype d, Datatype d', SameStructure f f') => D1 d f a -> D1 d' f' a -> Maybe (D1 d f :~: D1 d' f')
sameRep l@(M1 l') r@(M1 r') = do Refl <- sameDatatype l r
	      	        	 Refl <- sameStructure l' r'
				 return Refl
<commit_msg>sameRep' can tell if a b equal from looking at the reps<commit_after>{-# LANGUAGE FlexibleInstances, GADTs, MultiParamTypeClasses, TypeOperators, TypeSynonymInstances, ViewPatterns #-}

module Data.Type.Equality.Generics where

import Data.Type.Equality
import GHC.Generics
import Unsafe.Coerce (unsafeCoerce)

sameRep' :: (Generic a, Generic b, Rep a ~ D1 d f, Rep b ~ D1 d' f', Datatype d, Datatype d', SameStructure f f') => Rep a x -> Rep b x -> Maybe (a :~: b)
sameRep' l r = do Refl <- sameRep l r
	       	  return $ unsafeCoerce Refl

sameRep :: (Datatype d, Datatype d', SameStructure f f') => D1 d f a -> D1 d' f' a -> Maybe (D1 d f :~: D1 d' f')
sameRep l@(M1 l') r@(M1 r') = do Refl <- sameDatatype l r
	      	        	 Refl <- sameStructure l' r'
				 return Refl

{'fraction_non_alphanumeric': 0.12585969738651995, 'fraction_numerical': 0.011004126547455296, 'mean_word_length': 3.1930835734870318, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4180418', 'n_tokens_mistral': 561, 'n_tokens_neox': 524, 'n_words': 201}