🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.functional
Article #588

Re: Type checking with physical dimensions

#588
From: David Barton
Date: Mon, 28 Sep 1992 15:04
41 lines
2278 bytes
I was going to respond to this by Email; however, since it might be of
general interest, I am responding to the list.

In article <14724@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au
(Richard A. O'Keefe) writes:

   Has anyone extended a Hindley/Milner-style type checker to check
   physical dimensions (mass,length,time,current,&c)?  I have my own ideas
   about how to do it, but before I start coding and writing, I'd like to
   know what has already been done.  (I already know that it is possible to
   combine polymorphism with dimension checking; I _think_ I can see a way
   to combine them with integer/float overloading; I believe that automatic
   scaling can be done in a functional language but not in a logic programming
   language, but don't ask me to prove it yet.)

We are desigining a microwave hardware description language based upon
Haskell.  We have written a Physical type which is simply another data
type under the Haskell class system; thus, overloading with standard
operators simply involves a new data instance for each appropriate
class that defined the operators for type Physical.

Our physical datatype includes (not bothering with the Haskell
syntax):

1) A 10-tuple that corresponds to the appropriate "exponent", or
dimension, of each of the standard ISO "basic" units (we added
dollars).

2) A rational multiplier (for factors of the same dimenstion: feet and
meters, for example).  A multiplier of one refers to the ISO standard
units. 

3) The numeric part (the "10" in "10 miles").

The definition of arithemetic operations on these quantities is fairly
trivial.

Please Email me if there are questions.

					Dave Barton
					dlb@hudson.wash.inmet.com
Technical Details
Message-ID: <DLB.92Sep28100432@fanny.wash.inmet.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!hri.com!noc.near.net!inmet!inmet!dlb
References: <14724@goanna.cs.rmit.oz.au>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!hri.com!noc.near.net!inmet!inmet!dlb
From: dlb@fanny.wash.inmet.com (David Barton)
Newsgroups: comp.lang.functional
Subject: Re: Type checking with physical dimensions
Message-ID: <DLB.92Sep28100432@fanny.wash.inmet.com>
Date: 28 Sep 92 15:04:32 GMT
References: <14724@goanna.cs.rmit.oz.au>
Sender: news@inmet.camb.inmet.com
Organization: Intermetrics Inc., Washington Division, USA
Lines: 41
In-Reply-To: ok@goanna.cs.rmit.oz.au's message of 28 Sep 92 08:08:58 GMT
Nntp-Posting-Host: fanny.wash