<p dir="ltr">What I'd like for Data.List is</p>
<p dir="ltr">uncons :: [a] -> Maybe (a, [a]).<br>
uncons [] = Nothing<br>
uncons (a:as) = Just (a,as)</p>
<p dir="ltr">I believe Data.Text and maybe even Data.ByteString have similar functions. The main reason, I think:</p>
<p dir="ltr">The idiom</p>
<p dir="ltr">do<br>
x <- listToMaybe xss<br>
...<br>
... tail xss<br>
...</p>
<p dir="ltr">is a bit ugly as the safety of tail xs depends implicitly on the fact that listToMaybe guards it, and because it treats the head and tail completely differently. Far prettier:</p>
<p dir="ltr">do<br>
(x,xs) <- uncons xss<br>
...</p>