1{-# LANGUAGE TypeFamilies #-}
2{-# LANGUAGE RankNTypes #-}
4module Data.Tabulation where
8-- | This is a class for record types whose fields can be enumerated by an associated GADT. It's closely related to the concept of a representable functor, except without the functor part, and the fields are not all the same type.
10 type Field a :: * -> *
12 fieldLens :: Field a x -> Lens' a x
13 tabulateFieldsA :: Applicative f => (forall x. Field a x -> f x) -> f a
15 tabulateFields :: (forall x. Field a x -> x) -> a
16 tabulateFields f = runIdentity (tabulateFieldsA (Identity . f))
17 traverseWithField :: Applicative m => (forall x. Field a x -> x -> m x) -> a -> m a
18 traverseWithField t r = tabulateFieldsA (\f -> t f (indexField r f))
19 indexField :: a -> Field a x -> x
20 indexField a f = a ^. fieldLens f
21 {-# MINIMAL fieldLens, tabulateFieldsA #-}
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list