Re:Haskell web programming (a simple tutorial)
by gtani on Sunday January 22, 2012 @12:58PM
(#3497145)
Yeah, there's Dimensional package, and I've seen people using algebraic data types, or (RWH) a Units type
http://necrobious.blogspot.com/2009/03/fun-example-of-haskel...
http://flygdynamikern.blogspot.com/2011/04/announce-dimensio...
http://book.realworldhaskell.org/read/data-structures.html#x...
Re:Haskell web programming (a simple tutorial)
by prof_hobart on Saturday January 21, 2012 @04:39PM
(#3494737)
Most languages can help you avoid using the wrong one through the use of variable names.
The problems you might run into are more (for example) using the wrong algorithm for calculating gravity, adjusting the position of one planet before using it to evaluate its impacts on other planets, failing in collision detection etc.
I don't see anything in Haskell that would prevent me from doing any of those.
Re:Haskell web programming (a simple tutorial)
by SomeOtherGuy on Monday January 23, 2012 @10:13AM
(#3500584)
>Most languages can help you avoid using the wrong one through the use of variable names.
That doesn't help at all, are you serious? Cause you genuinely sound like you are trolling. Especially when you say things like "if a language can't prevent every possible bug then there's no poing having it prevent any bugs".
In code where the types start to to tell you less, e.g. when doing a bunch of number crunching, and you have a signature that looks like:
It's common for the programmer to use a "newtype wrapper" to bring some of the logic into the type system like: Then the type system will catch if you accidentally use the Velocity when what you want is Force, etc.