<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>You're now looking at the difference between:</p>
<pre>-- list of booleans but the end has an Int
data T1 = End1 Int | Node1 Bool T1
whatInt1 (End1 i) = i
whatInt1 (Node1 _ xs) = whatInt1 xs
</pre>
<p>and</p>
<pre>-- list of booleans but the end has an Int again but different
data T2 = End2 Int | FalseNode2 T2 | TrueNode2 T2
whatInt2 (End2 i) = i
-- the following two cases are unmergeable
-- but there is a mitigation if you find out about "record syntax"
whatInt2 (FalseNode2 xs) = whatInt2 xs
whatInt2 (TrueNode2 xs) = whatInt2 xs
</pre>
<p>Record syntax can mitigate it:<br>
</p>
<pre>data T3 = End3 Int | FalseNode3 {tail3 :: T3} | TrueNode3 {tail3 :: T3}
whatInt3 (End3 i) = i
whatInt3 r = whatInt3 (tail3 r)
</pre>
<p>But I say "mitgate", not "solve", because it doesn't generalize
to<br>
</p>
<pre>data Q = QI Int
| QF {qtail :: Q} | QT {qtail :: Q}
| BF{qleft, qright :: Q} | BT{qleft, qright :: Q}
</pre>
<div class="moz-cite-prefix">On 2021-03-12 7:59 p.m., Galaxy Being
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFAhFSWkJA4b5oON4kmEiK+P7PhhJ9sJJeZOuRmemhRfGdGcgQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">However, I'm still wondering how to have an
abstracted (x:xs) - like pattern to collapse all the
ingredients, i.e.,
<div><br>
</div>
<div>whatHolder2 (Holder2 (sh)) = sh<br>
whatHolder2 (shish2-head (shish2-tail)) = whatHolder2
shish2-tail<br>
</div>
</div>
</blockquote>
</body>
</html>