<div dir="auto">There's an extension to GHC: 'Postfix Operators' .<div><a href="https://downloads.haskell.org/~ghc/8.6.1/docs/html/users_guide/glasgow_exts.html#postfix-operators">https://downloads.haskell.org/~ghc/8.6.1/docs/html/users_guide/glasgow_exts.html#postfix-operators</a></div><div dir="auto"><br></div><div dir="auto">Turns out Hugs can do that too (in Hugs mode).</div><div dir="auto"><br></div><div dir="auto">> <span style="font-size:12pt;font-family:Helvetica">(!) :: Num a => a -> a </span><span style="font-size:12pt;font-family:Helvetica"> </span><span style="font-size:12pt;font-family:Helvetica">-- note defined as monadic</span></div>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica"><span style="font-size:12pt">> (!) 0 = 1 -- lhs of equation must use prefix form</span><br></p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica"><span style="font-size:12pt">> (!) n = n * ((n - 1) !) -- but rhs can use postfix</span></p><div dir="auto"><span style="font-size:12pt"><br></span></div><div dir="auto"><span style="font-size:12pt">So (3 !) returns 6, etc. The parens are needed so that it's parsed as a section.</span></div><div dir="auto"><span style="font-size:12pt"><br></span></div><div dir="auto"><span style="font-size:12pt">I also took a leaf out of Oleg's book and built a variadic postfix operator</span></div><div dir="auto"><span style="font-size:12pt"><div><a href="http://okmij.org/ftp/Haskell/polyvariadic.html">http://okmij.org/ftp/Haskell/polyvariadic.html</a></div><br></span></div><div dir="auto"><span style="font-size:12pt">That is, (3 ~- 7) is parsed as 'subtract 3 from 7'. (3 ~-) is parsed as postfix negate 3 aka 'subtract 3 from zero'. It kinda worked, but the terms need a lot of explicit signatures and/or tricky type casting.</span></div><div dir="auto"><span style="font-size:12pt"><br></span></div><div dir="auto"><span style="font-size:12pt"><br></span></div><div dir="auto"><span style="font-size:12pt">AntC</span></div></div>