
Hi, In C++, template can be used to enforce the dimension. For example, F=m*a is OK and F=m*t will issue a compile time error. Is there a way to do this in Haskell? Thanks, Haihua

Excerpts from Haihua's message of Fri Apr 09 12:28:23 -0400 2010:
In C++, template can be used to enforce the dimension. For example, F=m*a is OK and F=m*t will issue a compile time error.
Is there a way to do this in Haskell?
http://hackage.haskell.org/package/dimensional Cheers, Edward

Hello Haihua, Friday, April 9, 2010, 8:28:23 PM, you wrote:
In C++, template can be used to enforce the dimension. For example, F=m*a is OK and F=m*t will issue a compile time error.
Is there a way to do this in Haskell?
yes. but standard * operation has type t->t->t. so you need either to use other operation or don't import standard Num class -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Sat, 10 Apr 2010, Haihua wrote:
Hi, In C++, template can be used to enforce the dimension. For example, F=m*a is OK and F=m*t will issue a compile time error.
http://www.haskell.org/haskellwiki/Libraries_and_tools/Mathematics#Physical_...
participants (4)
-
Bulat Ziganshin
-
Edward Z. Yang
-
Haihua
-
Henning Thielemann