CC: Functional dependencies question

oleg@pobox.com oleg@pobox.com
Mon, 12 May 2003 22:33:22 -0700 (PDT)


> > then the user can write
> >       hbar = 6.62606876e-34 `scalarm` (joule `mult` second)

> That works, but IMO it's a bit unwieldy.  It also doesn't help with
> actually defining a reasonable type signature for hbar which is the
> point of the exercise.


Well, how about this?

hbar = (PhysicalUnit 6.62606876e-34)::t where
  x::t = (undefined::Energy) `mult` (undefined::Time)

the use of bottom might be a bit bizarre -- OTH, a physicist of a kind
that cares about Planck constant should get used to the infinities --
take QED for example. A physicist might even appreciate that equation.


It's interesting that in every thread I have participated over the
last couple of months I mentioned 'undefined'. It must be my favorite
Haskell value.