<div style="font-family: 'Times New Roman'; font-size: 16px;">Hi,<br />The code [1] below compiles and runs with GHCi version 7.0.4.<br />I get one warning and an error message with GHCi version 7.6.1.<br /><br />1)  Warning -XDatatypeContexts is deprecated. Unless there are propagation effects, this is well explained.<br /><br />2) foom-1.hs:65:15:<br />    `quality' is applied to too many type arguments<br />    In the type `quality entity -&gt; agent -&gt; IO Observation'<br />    In the class declaration for `OBSERVERS'<br />Failed, modules loaded: none.<br /><br />I do not understand the error message from 7.6.1.  <br />I am not too interested actually fixing it, I just want to understand it.<br /><br />Thanks,<br />Pat<br /><br />[1]The code is from: A Functional Ontology of Observation and Measurement Werner Kuhn<br /><br />{-# LANGUAGE DatatypeContexts,MultiParamTypeClasses  #-}<br />module ENDURANTS where<br />import System.Time<br />type Id = String<br />type Position = Integer<br />type Moisture = Float<br />type Celsius = String<br />type Heat =  Float <br /><br /><br />data WeatherStation = WeatherStation Id Position deriving Show<br />data Value = Boolean Bool | Count Int | Measure Float | Category String deriving Show<br />data Observation = Observation Value Position ClockTime deriving Show<br />data AmountOfAir = AmountOfAir Heat Moisture  deriving Show<br /><br />muensterAir = AmountOfAir  10.0 70.0<br /><br />class ENDURANTS endurant where<br /> <br />-- must add instances all down the hierarchy for each instance<br />instance ENDURANTS WeatherStation where<br />instance ENDURANTS AmountOfAir where<br /><br />class ENDURANTS physicalEndurant =&gt; PHYSICAL_ENDURANTS physicalEndurant where<br /><br />instance PHYSICAL_ENDURANTS WeatherStation where<br />instance PHYSICAL_ENDURANTS AmountOfAir where<br /><br />class PHYSICAL_ENDURANTS  amountOfMatter =&gt; AMOUNTS_OF_MATTER amountOfMatter where<br /><br />instance AMOUNTS_OF_MATTER   WeatherStation where<br /><br />class PHYSICAL_ENDURANTS physicalObject =&gt; PHYSICAL_OBJECTS physicalObject where<br /><br />instance PHYSICAL_OBJECTS WeatherStation where<br /><br />class PHYSICAL_OBJECTS apo =&gt; APOS apo where<br /> getPosition :: apo -&gt; Position<br /><br /><br />instance APOS WeatherStation where<br /> getPosition (WeatherStation iD pos) = pos + 10<br />  <br />-- a data type declaration and data type constructor.<br />data PHYSICAL_ENDURANTS physicalEndurant =&gt; Temperature physicalEndurant = Temperature physicalEndurant deriving Show<br /><br />-- Qualities the class of all quality types (= properties) is a constructor class<br />-- its constructors can be applied to endurants, perdurants, qualities or abstracts<br />class QUALITIES quality entity <br /><br />instance QUALITIES Temperature AmountOfAir<br /><br />class (APOS agent, QUALITIES quality entity) =&gt; OBSERVERS agent quality entity where<br />   observe :: quality entity -&gt; agent -&gt; IO Observation<br />   express :: quality entity -&gt; agent -&gt; Value<br />   observe quale agent = do<br />                       clockTime &lt;- getClockTime<br />                       return (Observation (express quale agent) <br />                                  (getPosition agent) clockTime)<br /><br />instance OBSERVERS WeatherStation Temperature AmountOfAir where<br />  express (Temperature (AmountOfAir heat moisture)) weatherStation =  Measure heat <br /><br />{-<br />-- running the following<br />express (Temperature (AmountOfAir 40 20)) (WeatherStation &quot;rr&quot; 6)<br />-- Gives<br />Measure 40.0 Measure 40.0<br />-- We can get the type: Value <br />:t express (Temperature (AmountOfAir 40 20)) (WeatherStation &quot;rr&quot; 6)<br /><br />-}<br /><br /><br /><br /></div>
<br clear=all> Tá an teachtaireacht seo scanta ó thaobh ábhar agus víreas ag Seirbhís Scanta Ríomhphost de chuid Seirbhísí Faisnéise, ITBÁC agus meastar í a bheith slán.  <a href="http://www.dit.ie">http://www.dit.ie</a><br>
This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be clean.  <a href="http://www.dit.ie">http://www.dit.ie</a>