Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 a = Rep (SmallArray (f Any))
- map' :: (forall x. f x -> g x) -> Rep f a -> Rep g a
- sequenceA :: Applicative m => Rep (m :.: f) a -> m (Rep f a)
- unsafeFromList :: [b] -> Rep (K b) a
- unsafeFromListAny :: [f Any] -> Rep f a
- collapse :: Rep (K a) b -> [a]
- toListAny :: Rep f a -> [f Any]
- noInlineUnsafeCo :: forall a b. a -> b
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)) |
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
.
Conversion
unsafeFromList :: [b] -> Rep (K b) a Source #
Convert list to Rep
Does not check that the list has the right number of elements.
unsafeFromListAny :: [f Any] -> 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 :: forall a b. 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.