On Monday, June 15, 2015, Shishir Srivastava <<a href="mailto:shishir.srivastava@gmail.com">shishir.srivastava@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi, </div><div><br></div><div>The Data.Complex package defines the new data type 'Complex' as </div><div><br></div><div>----------</div><div><pre style="color:rgb(0,0,0)"><span style="color:blue">data</span> <span>Complex</span> <span>a </span> <span style="color:red">=</span> <span>!</span><span>a</span> <span>:+</span> <span>!</span><span>a</span> </pre><pre style="color:rgb(0,0,0)">-------</pre></div><div>Where ':+' is an infix operator. I don't however understand the usage of '!' in front of the type variable 'a'. What exactly is the purpose of '!' ?</div></div></blockquote><div><br></div><div>'!' is a strictness annotation. This means that when the value is forced to weak-head normal form (by pattern matching, BangPatterns, or seq), then the fields with the ! will also be forced to weak-head normal form.</div><div><br></div><div>See also:</div><div><a href="http://chimera.labs.oreilly.com/books/1230000000929/ch02.html#sec_par-eval-whnf">http://chimera.labs.oreilly.com/books/1230000000929/ch02.html#sec_par-eval-whnf</a><br></div><div><a href="https://hackhands.com/lazy-evaluation-works-haskell/">https://hackhands.com/lazy-evaluation-works-haskell/</a><br></div><div><br></div><div>-bob</div>