<div dir="ltr"><div>I am trying to understand how to interpret  type variables in Haskell class declarations from a <a href="http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=1EA31D76684217BC728F916144BC6C38?doi=10.1.1.109.6853&rep=rep1&type=pdf">paper</a>. <br></div><div>With respect to the code below I have the following questions:<br></div><div>1. What is the difference between "a b" in the header of the Container class and "a b" in the signature of the class methods? Does the whitespace in header mean 2 distinct types and in the methods mean function application?</div><div>2. In the Boathouse class what is the difference between the first ocurance of "b p" and the second bracketed "(b p)"?</div><div>3. When I try to make instance of these classes I seem to need FlexibleInstances. Why is this?</div><div><br></div><div><br></div><div><br></div><div>{-# LANGUAGE MultiParamTypeClasses #-}</div><div>-- Containers a b stands for all container types a holding things of type b.<br></div><div>-- from :info command a has kind *->*, b has kind *</div><div>class Containers a b where</div><div> insert :: b -> a b -> a b</div><div> remove :: b -> a b -> a b</div><div> whatsIn :: a b -> [b]</div><div><br></div><div><br></div><div>class Surfaces a b where</div><div> put :: b -> a b -> a b</div><div> takeOff :: b -> a b -> a b</div><div> whatsOn :: a b -> [b]</div><div><br></div><div>-- from :info command  "p" has kind  *, "h" and "b" have kind *->*</div><div>class People p</div><div>class Containers h p => Houses h p where  </div><div>class (People p, Surfaces h p) => Boats h p where </div><div>class (Boats b p,Houses h (b p)) => BoatHouses h b p  where</div><div>class (People p, Houses h (b p),Boats b p) => HouseBoats h b p</div></div>

<br>
<p><span lang="EN-GB"><font size="2">This email originated from DIT. If you received this email in error, please delete it from your system. Please note that if you are not the named addressee, disclosing, copying, distributing or taking any action based on the contents of this email or attachments is prohibited. <a href="http://www.dit.ie/" target="_blank">www.dit.ie</a></font></span></p><p><font size="2">Is ó ITBÁC
a tháinig an ríomhphost seo. Má fuair tú an ríomhphost seo trí earráid, scrios
de do chóras é le do thoil. Tabhair ar aird, mura tú an seolaí ainmnithe, go
bhfuil dianchosc ar aon nochtadh, aon chóipeáil, aon dáileadh nó ar aon ghníomh
a dhéanfar bunaithe ar an ábhar atá sa ríomhphost nó sna hiatáin seo. <a href="http://www.dit.ie/" target="_blank">www.dit.ie</a></font></p><p><a href="http://www.dit.ie/grangegorman" target="_blank"><font size="2">Tá ITBÁC ag aistriú go Gráinseach Ghormáin – DIT is on the move to Grangegorman</font></a></p>