Skip to content

Commit

Permalink
Add FieldHKD
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfmpe committed Jan 16, 2022
1 parent 4b86459 commit c2bbc0b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/tabulation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 7 additions & 2 deletions lib/tabulation/src/Data/Tabulation.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}

module Data.Tabulation where

Expand All @@ -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 #-}
{-# 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)

0 comments on commit c2bbc0b

Please sign in to comment.