Wow! Thanks Stéphane... that was a little piece of magic I was
hoping for. It's a bit verbose, but at least it doesn't affect
performance and it allows all the control over types I need.
I now see I didn't really grok phantom types whenever they were
mentioned. A bit of "in one ear and out the oth
On 01-05-2010, Dario Teixeira wrote:
> Hi,
>
>> type kinematic = { lin: Vec.t; ang: Vec.t }
>>
>> Which I've been using to represent a medley of physical attributes (force, >
>> momentum, velocity, etc.).
>
> I second Stéphane's suggestion of using phantom types; moreover,
> I recommend you read
Hi,
> type kinematic = { lin: Vec.t; ang: Vec.t }
>
> Which I've been using to represent a medley of physical attributes (force, >
> momentum, velocity, etc.).
I second Stéphane's suggestion of using phantom types; moreover,
I recommend you read an article that discusses them to some detail
and
Hi Anthony,
I think that maybe using phantom types could do the trick : consider
defining empty types for all the different "kinds" of similar
constructs that you have, and then define the kinematic record with a
phantom parameter type.
type position
type acceleration
type force
type 'a kinematic
I have this:
type kinematic = { lin: Vec.t; ang: Vec.t }
Which I've been using to represent a medley of physical attributes (force,
momentum, velocity, etc.).
As the physics code becomes increasingly substantial I'm running into
possible human-error, like passing a momentum where a force is ex
[sorry if you receive this more than once]
CALL FOR PAPERS
DEADLINE FOR TWO-PAGE ABSTRACTS EXTENDED TO MAY, 10th
WADT 2010
20th International Workshop on
Algebraic Development Techniques