| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Record.Generic.Rep.Internal
Description
Definition of Rep and functions that do not depend on ".Generic"
Defined as a separate module to avoid circular module dependencies.
Synopsis
- newtype Rep (f :: Type -> Type) a = Rep (SmallArray (f (Any :: Type)))
- map' :: (forall x. f x -> g x) -> Rep f a -> Rep g a
- sequenceA :: forall m (f :: Type -> Type) a. Applicative m => Rep (m :.: f) a -> m (Rep f a)
- unsafeFromList :: [b] -> Rep (K b :: Type -> Type) a
- unsafeFromListAny :: [f (Any :: Type)] -> Rep f a
- collapse :: Rep (K a :: Type -> Type) b -> [a]
- toListAny :: Rep f a -> [f (Any :: Type)]
- noInlineUnsafeCo :: a -> b
Documentation
newtype Rep (f :: Type -> Type) a Source #
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.
Constructors
| Rep (SmallArray (f (Any :: Type))) |
Basic functions
map' :: (forall x. f x -> g x) -> Rep f a -> Rep g a Source #
Strict map
map' f x is strict in x: if x is undefined, map f x will also be
undefined, even if f never needs any values from x.
sequenceA :: forall m (f :: Type -> Type) a. Applicative m => Rep (m :.: f) a -> m (Rep f a) Source #
Conversion
unsafeFromList :: [b] -> Rep (K b :: Type -> Type) a Source #
Convert list to Rep
Does not check that the list has the right number of elements.
unsafeFromListAny :: [f (Any :: Type)] -> Rep f a Source #
Convert list to Rep
Does not check that the list has the right number of elements, nor the types of those elements.
Auxiliary
noInlineUnsafeCo :: a -> b Source #
Avoid potential segfault with ghc < 9.0
See https://gitlab.haskell.org/ghc/ghc/-/issues/16893. I haven't actually seen this fail in large-records, but we saw it fail in the compact representation branch of sop-core, and what we do here is not so different, so better to play it safe.