The README says unalign can be defined for any Functor. Am I missing something? That doesn't seem right:
unalignDefault :: Functor f => f (These a b) -> (f a, f b)
unalignDefault xs =
( fmap (\case; This a -> a; That b -> _ :: a; These a _ -> a) xs
, fmap (\case; This a -> _ :: b; That b -> b; These _ b -> b) xs
)
There are holes we can't fill.
Interestingly, it would seem thatunaligncan be implemented for any Filterable. I don't know if it's lawful:
unalignDefault :: Filterable f => f (These a b) -> (f a, f b)
unalignDefault xs =
( mapMaybe (\case; This a -> Just a; That _ -> Nothing; These a _ -> Just a) xs
, mapMaybe (\case; This _ -> Nothing; That b -> Just b; These _ b -> Just b) xs
)
Given the compatibility note in the unalign docs, I'm guessing that the README was written about this version, before semialign was split out of these.
The README says
unalign
can be defined for any Functor. Am I missing something? That doesn't seem right:There are holes we can't fill.
Interestingly, it would seem that
unalign
can be implemented for anyFilterable
. I don't know if it's lawful:Given the compatibility note in the
unalign
docs, I'm guessing that the README was written about this version, beforesemialign
was split out ofthese
.I'll submit a PR soon.