<div dir="ltr"><div>Imants<br></div>Thanks for the sanity check on the instances.<div><br><div>I am concerned about the use of the function immsucc' from the same <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.36.9395">paper</a>, which is defined in instances the Time class (but omitted from the class). The function immsucc' is first used without arguments, which to me implies that it 'might' a function passed to the higher-order closure function. It is then used as just an ordinary function with arguments. I have found a version of closure based on <a href="https://github.com/buntine/Haskell--Craft-of-FP/blob/master/AbsTypes/Relation.lhs">Craft of Function Programming.</a> which does not require a function as an argument.</div><div><br></div><div>So basically my question is: does the usage of immsucc' make sense in the code below?, do the types match up?</div><div>Regards,</div><div>Pat</div><div><br></div><div><br></div><div><br></div><div>data TimeFacts t = Bef (t, t, TimeFacts t) | New<br></div><div><br></div><div><div>class SetClass t => Time l t where</div><div> new :: (t, t) -> l t</div><div> bef :: (t, t, l t) -> l t</div><div> succ , pred :: (t, l t) -> Set t</div><div> immsucc , immpred :: (t, l t) -> Set t</div><div> before, after :: (t, t, l t) -> Bool</div><div> immedbefore, immedafter :: (t, t, l t) -> Bool</div><div> immedafter (a, b, t) = immedbefore (b, a, t)</div><div> after (a, b, t) = before (b, a, t)</div><div> before (a, b, t) = memberInSet (b, succ (a, t))</div><div> succ (a, tl) = closure ([a], immsucc' , tl)</div><div> pred (a, tl) = closure ([a], immpred' , tl)</div><div> immsucc (a, tl) = immsucc' ([a], [], tl)</div><div> immpred (a, tl) = immpred' ([a], [], tl)</div></div><div><br></div><div><div>instance (SetClass t) => Time TimeFacts t where</div><div> immsucc’ (a, s, New ) = s<br></div><div> immsucc’ (a, s, Bef (e, f, tt)) = if memberInSet (e,a) then immsucc’ (a, insertInSet (f,s), tt) else immsucc’ (a, s,tt)</div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 3 November 2016 at 18:05, Imants Cekusins <span dir="ltr"><<a href="mailto:imantc@gmail.com" target="_blank">imantc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>this builds. not sure if the instances are as intended</div><div><br></div><div><br></div><div>{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}</div><div>module SetClass where</div><span class="gmail-"><div><br></div><div>data TimeFacts t = Bef (t, t, TimeFacts t) | New</div><div><br></div><div>class SetClass t where</div><div>class SetClass t => Time l t where</div><div>class Time l t => TimeE l t where</div><div>class Time l t => TimeTO l t where</div><div><br></div><div><br></div></span><span class="gmail-"><div>instance SetClass (TimeFacts t) where -- OK</div></span><div>instance (SetClass t) => Time (TimeFacts t) t where</div><div>instance (SetClass t) => TimeE (TimeFacts t) t where</div><div>instance (SetClass t) => TimeTO (TimeFacts t) t where</div><div><br></div></div>
<br>______________________________<wbr>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div></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>