title: Haskell -> Printing sortBy list - error: parse error on input ‘print’
body: <p>I was trying to run this program on ghci, where it reorders the names in the ascending order of their last names. However, when I run it, I get this error <strong>&quot; error: parse error on input ‘print’ &quot;</strong>. <br> I would truly appreciate it if you can help me out with this. Thank you![enter image description here][1]</p>
  <pre><code>import Data.List
  
  main :: IO ()
  
  names = [(&quot;Tatsunori&quot;, &quot;Ono&quot;), (&quot;Kishore&quot;, &quot;Palanisamy&quot;), (&quot;Calder&quot;, &quot;Hosgood&quot;), (&quot;Yiling&quot;, &quot;Zhuang&quot;)]
  
  main = do
   let compareLastNames name1 name2 = if lastName1 &gt; lastName2
                                        then GT
                                        else if lastName1 &lt; lastName2
                                              then LT
                                              else EQ
     where lastName1 = snd name1
           lastName2 = snd name2
     
     print (sortBy compareLastNames names)
  </code></pre>