Hi Oscar,<br><br>Define<br><br> result = (.)<br><br>Then '(result f) g' applies f to the result part of a function g. That's what you want when negating the result of not. For (==), you want to negate the result of the result, so you'd instead say '(result.result) not (==)'. Keep composing result for deeper applications.<br>
<br>If you want to edit/transform the first or second part of a pair instead of the result of a function, then you'd use 'first' or 'second' in place of 'result'.<br><br>If you think of f (here f=not) as an "semantic editor" (transformer) of values, then 'result', 'first', and 'second' are "semantic editor combinators", which can be composed together arbitrarily. See <a href="http://conal.net/blog/semantic-editor-combinators">http://conal.net/blog/semantic-editor-combinators</a> .<br>
<br> - Conal<br><br><div class="gmail_quote">2008/12/26 Oscar Picasso <span dir="ltr"><<a href="mailto:oscarpicasso@gmail.com">oscarpicasso@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>I can write:<br>*Main> let yes = not . not<br>*Main> :t yes<br>yes :: Bool -> Bool<br><br>But not:<br>*Main> let isNotEqual = not . (==)<br><br><interactive>:1:23:<br> Couldn't match expected type `Bool'<br>
against inferred type `a -> Bool'<br> Probable cause: `==' is applied to too few arguments<br> In the second argument of `(.)', namely `(==)'<br> In the expression: not . (==)<br><br>
Why?<br><font color="#888888"><br>Oscar<br><br></font></blockquote></div><br>