<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Why this works :P<div class=""><div class="">bmaxa@Branimirs-Air haskell % ghc -O2 semi.hs</div><div class="">Loaded package environment from /Users/bmaxa/.ghc/aarch64-darwin-8.10.7/environments/default</div><div class="">[1 of 1] Compiling Main ( semi.hs, semi.o )</div><div class="">Linking semi ...</div><div class="">bmaxa@Branimirs-Air haskell % ./semi</div><div class="">[1,2,3,3,2,1]</div><div class="">bmaxa@Branimirs-Air haskell % cat semi.hs</div><div class="">main = do</div><div class=""> let lst = lrl [1,2,3]</div><div class=""> print lst</div><div class="">; ; ; ; ; ; ; ;;;;lrl :: [a]->[a]; ;; ; ; ; ; lrl xs = xs ++ reverse xs</div><div><br class=""><blockquote type="cite" class=""><div class="">On 28.09.2021., at 12:00, Anthony Clayden <<a href="mailto:anthony.d.clayden@gmail.com" class="">anthony.d.clayden@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><font face="arial, sans-serif" class="">From the department of improbable syntax/I don't get how this works, but it does:</font><div class=""><font face="arial, sans-serif" class=""><br class=""></font></div><div class=""><font face="arial, sans-serif" class="">> f :: [a] -> [a]</font></div><font face="arial, sans-serif" class="">> ;; f xs = xs ++ reverse xs<br class=""><br class="">Nicely (to my eye) groups/indents the binding under the signature. Especially handy with ScopedTypeVariables, to show how the scoped vars 'belong'<br class=""></font><div class=""><font face="arial, sans-serif" class=""><br class=""></font></div><div class=""><font face="arial, sans-serif" class="">> f :: forall a. [a] -> [a]<br class=""></font></div><div class=""><font face="arial, sans-serif" class="">> ;; f xs = xs ++ ys<br class="">> where<br class="">> ys :: [a]<br class="">> ys = reverse xs<br class=""></font><div class=""><font face="arial, sans-serif" class=""><br class=""></font></div></div><div class=""><font face="arial, sans-serif" class="">The doubled `;;` </font><span style="font-family:Arial,Helvetica,sans-serif" class="">stands out like a ditto. It </span>could be a single semicolon (which means there's an empty decl/binding between the semis -- I don't see that's allowed by the syntax).</div><div class=""><br class=""></div><div class=""><font face="arial, sans-serif" class="">Unfortunately, for multi-line bindings you need to repeat the `;;`</font></div><div class=""><font face="arial, sans-serif" class=""><br class=""></font></div><div class=""><font face="arial, sans-serif" class="">> f :: [a] -> [a]<br class="">> ;; f [] = []<br class="">> ;; f xs = xs ++ reverse xs<br class=""></font><br class=""></div></div>
_______________________________________________<br class="">Haskell-Cafe mailing list<br class="">To (un)subscribe, modify options or view archives go to:<br class=""><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" class="">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br class="">Only members subscribed via the mailman list are allowed to post.</div></blockquote></div><br class=""></div></body></html>