diff --git a/lib/tabulation/CHANGELOG.md b/lib/tabulation/CHANGELOG.md index fa52519d9..11401066b 100644 --- a/lib/tabulation/CHANGELOG.md +++ b/lib/tabulation/CHANGELOG.md @@ -1,5 +1,7 @@ # Revision history for tabulation +* Add FieldHKD - a wrapper to allow mixing/reusing a non-HDK associated GADT with the higher kinded data record + ## 0.1.0.0 -- 2019-05-24 * First version. Basically carve out this library as a place for the HasFields class. diff --git a/lib/tabulation/src/Data/Tabulation.hs b/lib/tabulation/src/Data/Tabulation.hs index 45e785307..4cbcc5248 100644 --- a/lib/tabulation/src/Data/Tabulation.hs +++ b/lib/tabulation/src/Data/Tabulation.hs @@ -1,5 +1,6 @@ -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE TypeFamilies #-} module Data.Tabulation where @@ -18,4 +19,8 @@ class HasFields a where traverseWithField t r = tabulateFieldsA (\f -> t f (indexField r f)) indexField :: a -> Field a x -> x indexField a f = a ^. fieldLens f - {-# MINIMAL fieldLens, tabulateFieldsA #-} \ No newline at end of file + {-# MINIMAL fieldLens, tabulateFieldsA #-} + +-- | A wrapper to allow mixing/reusing a non-HDK associated GADT with the higher kinded data record +data FieldHKD field f x where + FieldHKD :: field x -> FieldHKD field f (f x)