<div dir="ltr">Thank you Richard, Lennart, <i style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium">Gergő</i><div><i style="color:rgb(0,0,0);font-family:"Times New Roman";font-size:medium"><br></i></div><div><span style="color:rgb(0,0,0);font-family:monospace,monospace;font-size:1em;white-space:pre-wrap">></span><i style="color:rgb(0,0,0);font-size:1em;white-space:pre-wrap"> pattern Positive :: (Ord a, Num a) => a</i></div><pre style="white-space:pre-wrap;color:rgb(0,0,0)">><i> pattern Positive <- ((>0) -> True)</i></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><i><br></i></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><i>Heh heh, there's another surprise/undocumented 'feature'.</i></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><i>It's not necessary to give a signature for pattern `Positive`, GHC will infer that from the decl.</i></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><i>I was surprised to see `True`, and even more surprised there wasn't a `Bool` in the signature.  I guess that's so `Positive` can appear as a pattern in a case expr. To dig out the positive value in a lambda expr, it seems I go</i></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><i><br></i></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><i>> (\p@Positive -> p) 5         -- returns 5</i></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><i><br></i></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><i>Seems I can't use any trick like that to turn `Positive` into explicitly bidirectional. I also tried</i></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><i><br></i></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><pre style="white-space:pre-wrap">><i> pattern Positive' <- ((>0) -> ())</i></pre><pre style="white-space:pre-wrap"><i><br></i></pre><pre style="white-space:pre-wrap"><i>But that's rejected  '"</i>* Couldn't match expected type `Bool' with actual type `()'".</pre><pre style="white-space:pre-wrap">Is the hidden `Bool` documented somewhere? (Doesn't seem to be in the User Guide nor the wiki nor the paper, on a quick scan.)</pre><pre style="white-space:pre-wrap"></pre>

</pre></div>