Closed MaxGabriel closed 4 years ago
Seems reasonable to me. What about upgrading to nonNullToNonEmpty :: Foldable f => NonNull (f a) -> NE.NonEmpty a
, which I think should be fine.
I'm ok with that. I haven't looked at mono-traversable in awhile, but would it be better to use MonoFoldable
or just regular Foldable
?
toNonEmpty :: MonoFoldable mono => NonNull mono -> NE.NonEmpty (Element mono)
toNonEmpty = NE.fromList . otoList
Good point, that sounds better.
Mono-traversable has a nice interface for protecting against empty lists, but occasionally you do need to interface with something that asks for NonEmpty, such as persistent-qq's
%{}
value replacement.Do you think adding a function to go from nonNullToNonEmpty would be reasonable? Something like: