home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
hugs101.zip
/
hugs101o.zip
/
Progs
/
HUGS
/
Demos
/
temps.hs
< prev
next >
Wrap
Text File
|
1995-02-14
|
489b
|
16 lines
-- Representation of temperatures on both Fahrenheit and Celsius scales
--
-- This program cannot be used on any machine without support for floating
-- point numbers within Hugs (e.g. PCs).
data Temp = Celsius Float | Fahrenheit Float
fahrToCent f = (f-32.0)/1.8
instance Eq Temp where
Celsius c1 == Celsius c2 = c1==c2
Celsius c1 == Fahrenheit f2 = c1==fahrToCent f2
Fahrenheit f1 == Celsius c2 = fahrToCent f1==c2
Fahrenheit f1 == Fahrenheit f2 = f1==f2