<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<blockquote type="cite"
cite="mid:CA+TfdNbztv5OxoA_Zrr4nT_BoM1R_Pi-qxUwcOvSo5RXSYGmjg@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr"><font face="monospace, monospace">versionSort
:: [String] -> [String]</font>
<div>
<div style=""><font face="monospace, monospace">versionSort
= sortOn brkND</font></div>
<div style=""><font face="monospace, monospace"> where</font></div>
<div style=""><font face="monospace, monospace"> tr f
g (x,y) = f x : g y</font></div>
<div style=""><font face="monospace, monospace"> --
ND for non-digits</font></div>
<div style=""><font face="monospace, monospace">
brkND = tr Right brkD . span (not . isDigit)</font></div>
<div style=""><font face="monospace, monospace"> brkD
= tr (Left . read @Int) brkND . span isDigit</font></div>
<div style="font-family:arial,helvetica,sans-serif"><br>
</div>
</div>
<div><font face="arial, helvetica, sans-serif">(side
question: does the helper function </font><font
face="monospace,
 monospace">tr </font><font
face="arial, helvetica,
 sans-serif">I defined
above have a commonly known name?)</font></div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<p>I don't think so, but that's just because you made the cut at a
weird point. It's very close to <a
href="https://hoogle.haskell.org/?hoogle=%28***%29&scope=set%3Astackage"><tt>(***)</tt></a>
from <tt>Control.Arrow</tt>, <tt>Data.Tuple.Extra</tt>, <tt>Data.Profunctor</tt>,
and other libraries, also known as <a
href="https://hoogle.haskell.org/?hoogle=bimap&scope=set%3Astackage"><tt>bimap</tt></a>
in <tt>Data.Bifunctor</tt> and in the <tt>lens</tt> package.<br>
</p>
<p>Rewriting your functions to tease it out even more (not tested):<br>
</p>
<pre> versionSort :: [String] -> [String]
versionSort = sortOn gatherNonDigits
where
gatherAll predicate gather continue = uncurry (:) . (gather *** continue) . span predicate
-- 'NonDigits' for non-digits
gatherNonDigits = gatherAll (not . isDigit) wrapNonDigits gatherDigits
gatherDigits = gatherAll isDigit wrapDigits gatherNonDigits
wrapNonDigits = Right
wrapDigits = Left . read @Int
</pre>
<p><br>
</p>
</body>
</html>