Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | generics@haskell.org |
Summary: Generic function thats transposes a value f (g a)
to g (f a)
.
This is an interesting generic function since it uses multiple other generic
functions: Crush
, Enum
, Map
, and ZipWith
. Notably, Map
and
ZipWith
are required for definining the sum and product cases of the
generic function. The others make the generic function easy to use.
NOTE: Be aware of the special case for empty values noted in the
documentation of tranpose
.
Documentation
newtype Monad m => Transpose m f c b a Source
The type of a generic function that takes a generic value and non-generic container and returns the container filled with other generic values.
Transpose | |
|
transpose :: (Monad m, FRep (Crush [g a]) f, FRep2 (Transpose m g a) f) => f (g a) -> m (g (f a))Source
Transposes the structure of nested containers (types f
and g
). fail
if the outermost container is empty, because there is no generic way to
guarantee that both have unit constructors or, if they do, decide which one
to choose. See transposeE
for an alternative approach.