From 995c839f3febe48673f868b432647eb0c2555e7e Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Fri, 5 Aug 2016 09:59:15 -0400 Subject: [PATCH] Revert "Constrain record fields to be Typeable." This reverts commit 95fc1cb0ad4c7546450007b09fd690b4c84de1ce. --- src/Data/Record.hs | 6 +++--- src/Diffing.hs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Data/Record.hs b/src/Data/Record.hs index 006b61cc2..4106ae307 100644 --- a/src/Data/Record.hs +++ b/src/Data/Record.hs @@ -14,13 +14,13 @@ import Test.QuickCheck -- | This is heavily inspired by Aaron Levin’s [Extensible Effects in the van Laarhoven Free Monad](http://aaronlevin.ca/post/136494428283/extensible-effects-in-the-van-laarhoven-free-monad). data Record :: [*] -> * where RNil :: Record '[] - RCons :: Typeable h => h -> Record t -> Record (h ': t) + RCons :: h -> Record t -> Record (h ': t) deriving Typeable infixr 0 .: -- | Infix synonym for `RCons`: `a .: b .: RNil == RCons a (RCons b RNil)`. -(.:) :: Typeable h => h -> Record t -> Record (h ': t) +(.:) :: h -> Record t -> Record (h ': t) (.:) = RCons @@ -67,7 +67,7 @@ instance Ord (Record '[]) where _ `compare` _ = EQ -instance (Typeable field, Arbitrary field, Arbitrary (Record fields)) => Arbitrary (Record (field ': fields)) where +instance (Arbitrary field, Arbitrary (Record fields)) => Arbitrary (Record (field ': fields)) where arbitrary = RCons <$> arbitrary <*> arbitrary shrink (RCons h t) = RCons <$> shrink h <*> shrink t diff --git a/src/Diffing.hs b/src/Diffing.hs index 8bfab8c0f..052eabeca 100644 --- a/src/Diffing.hs +++ b/src/Diffing.hs @@ -118,11 +118,11 @@ readAndTranscodeFile path = do type TermDecorator f fields field = CofreeF f (Record fields) (Record (field ': fields)) -> field -- | Decorate the 'Term's produced by a 'Parser' using a function to compute the annotation values at every node. -decorateParser :: (Typeable field, Functor f) => TermDecorator f fields field -> Parser f (Record fields) -> Parser f (Record (field ': fields)) +decorateParser :: Functor f => TermDecorator f fields field -> Parser f (Record fields) -> Parser f (Record (field ': fields)) decorateParser decorator = (fmap (decorateTerm decorator) .) -- | Decorate a 'Term' using a function to compute the annotation values at every node. -decorateTerm :: (Typeable field, Functor f) => TermDecorator f fields field -> Cofree f (Record fields) -> Cofree f (Record (field ': fields)) +decorateTerm :: Functor f => TermDecorator f fields field -> Cofree f (Record fields) -> Cofree f (Record (field ': fields)) decorateTerm decorator = cata $ \ c -> cofree ((decorator (extract <$> c) .: headF c) :< tailF c) compareCategoryEq :: HasField fields Category => Term leaf (Record fields) -> Term leaf (Record fields) -> Bool