[Haskell-beginners] Constructor classes and type classes.

PATRICK BROWNE patrick.browne at dit.ie
Thu Nov 3 17:51:14 UTC 2016


Dimitri,
Thanks for taking the time and effort to respond. Your comments have
clarified some of my confusion. My motivation is that I am trying to
implement the code from a paper
<http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.36.9395> with the
following data and classes:

{-# LANGUAGE MultiParamTypeClasses #-}
data TimeFacts t = Bef (t, t, TimeFacts t) | New

class SetClass t  where
class SetClass t => Time l t  where
class Time l t => TimeE l t where
class Time l t => TimeTO l t where

However I cannot get the instances to compile:
instance SetClass (TimeFacts t) where -- OK
instance (SetClass t) => Time TimeFacts t where -- Expecting one more
argument to 'TimeFacts'
instance TimeE TimeFacts t where -- Expecting one more argument to
'TimeFacts'
instance TimeTO TimeFacts t where -- Expecting one more argument to
'TimeFacts'


Note, I am only using the headings for the classes and instances, which
should be OK.
Any pointers to a solution would be much appreciated.

Regards,
Pat

-- 


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. www.dit.ie

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. www.dit.ie

Tá ITBÁC ag aistriú go Gráinseach Ghormáin – DIT is on the move to 
Grangegorman <http://www.dit.ie/grangegorman>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20161103/e196c362/attachment.html>


More information about the Beginners mailing list