
5 Mar
2017
5 Mar
'17
5:51 a.m.
Since 'Data.List.NonEmpty' is now in 'base', it makes sense to change the type of 'some' from some :: Alternative f => f a -> f [a] to some :: Alternative f => f a -> f (NonEmpty a) as it's guaranteed to return a non-empty list. Currently, both users and implementors of 'Alternative' instances are at a disadvantage. The users have to use the unsafe NonEmpty.fromList function to take advantage of the fact that the result of 'some' is indeed non-empty. The implementors have more space for error - it's possible to accidentally return an empty list. I volunteer to implement. Does everyone agree it's a good idea?