Safe Haskell | None |
---|---|
Language | Haskell2010 |
Operations on the generic representation
We also re-export some non-derive functions to clarify where they belong in this list.
This module is intended for qualified import.
import qualified Data.Record.Generic.Rep as Rep
TODO: Could we provide instances for the generics-sop
type classes?
Might lessen the pain of switching between the two or using both?
Synopsis
- newtype Rep f a = Rep (SmallArray (f Any))
- map :: Generic a => (forall x. f x -> g x) -> Rep f a -> Rep g a
- mapM :: (Applicative m, Generic a) => (forall x. f x -> m (g x)) -> Rep f a -> m (Rep g a)
- cmap :: (Generic a, Constraints a c) => Proxy c -> (forall x. c x => f x -> g x) -> Rep f a -> Rep g a
- cmapM :: forall m f g c a. (Generic a, Applicative m, Constraints a c) => Proxy c -> (forall x. c x => f x -> m (g x)) -> Rep f a -> m (Rep g a)
- zip :: Generic a => Rep f a -> Rep g a -> Rep (Product f g) a
- zipWith :: Generic a => (forall x. f x -> g x -> h x) -> Rep f a -> Rep g a -> Rep h a
- zipWithM :: forall m f g h a. (Generic a, Applicative m) => (forall x. f x -> g x -> m (h x)) -> Rep f a -> Rep g a -> m (Rep h a)
- czipWith :: (Generic a, Constraints a c) => Proxy c -> (forall x. c x => f x -> g x -> h x) -> Rep f a -> Rep g a -> Rep h a
- czipWithM :: forall m f g h c a. (Generic a, Applicative m, Constraints a c) => Proxy c -> (forall x. c x => f x -> g x -> m (h x)) -> Rep f a -> Rep g a -> m (Rep h a)
- collapse :: Rep (K a) b -> [a]
- sequenceA :: Applicative m => Rep (m :.: f) a -> m (Rep f a)
- pure :: forall f a. Generic a => (forall x. f x) -> Rep f a
- cpure :: (Generic a, Constraints a c) => Proxy c -> (forall x. c x => f x) -> Rep f a
- ap :: forall f g a. Generic a => Rep (f -.-> g) a -> Rep f a -> Rep g a
- data Index a x
- indexToInt :: Index a x -> Int
- getAtIndex :: Index a x -> Rep f a -> f x
- putAtIndex :: Index a x -> f x -> Rep f a -> Rep f a
- updateAtIndex :: Functor m => Index a x -> (f x -> m (f x)) -> Rep f a -> m (Rep f a)
- allIndices :: forall a. Generic a => Rep (Index a) a
- mapWithIndex :: forall f g a. Generic a => (forall x. Index a x -> f x -> g x) -> Rep f a -> Rep g a
Documentation
Representation of some record a
The f
parameter describes which functor has been applied to all fields of
the record; in other words Rep I
is isomorphic to the record itself.
Rep (SmallArray (f Any)) |
Functor
cmap :: (Generic a, Constraints a c) => Proxy c -> (forall x. c x => f x -> g x) -> Rep f a -> Rep g a Source #
cmapM :: forall m f g c a. (Generic a, Applicative m, Constraints a c) => Proxy c -> (forall x. c x => f x -> m (g x)) -> Rep f a -> m (Rep g a) Source #
Zipping
zipWithM :: forall m f g h a. (Generic a, Applicative m) => (forall x. f x -> g x -> m (h x)) -> Rep f a -> Rep g a -> m (Rep h a) Source #
czipWith :: (Generic a, Constraints a c) => Proxy c -> (forall x. c x => f x -> g x -> h x) -> Rep f a -> Rep g a -> Rep h a Source #
czipWithM :: forall m f g h c a. (Generic a, Applicative m, Constraints a c) => Proxy c -> (forall x. c x => f x -> g x -> m (h x)) -> Rep f a -> Rep g a -> m (Rep h a) Source #
Foldable
Traversable
Applicable
ap :: forall f g a. Generic a => Rep (f -.-> g) a -> Rep f a -> Rep g a Source #
Higher-order version of *
Lazy in the second argument.
Array-like interface
indexToInt :: Index a x -> Int Source #
getAtIndex :: Index a x -> Rep f a -> f x Source #