Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Without types, how do you know you're not writing nonsense?


As someone who gave Haskell a shot, I was very quickly put off by having to learn functions to convert from integers to floats, while such things were automatically taken care of by more low-level programming languages such as C.

Also, I was confused by the package management with Cabal, and now I appear to have broken it with an error message whenever I start ghci. When choosing a first language for students, you have to think of idiots such as me.


I love Haskell. I hate Cabal. It's a bunch of semi-opaque goo on top of a compilation process that wasn't terribly hard to start with.


Where exactly were you mixing integers and floats? In my experience it doesn't come up too often, and if it does (e.g. writing area = 2 * pi * r) you'd be better served changing the 2 to 2.0.


I sometimes want to avoid using floats because of the inaccuracy that sometimes arise with their use. If I recall correctly, in Haskell division requires the numerator and denominator to be of the class fractional. So how I did integer division was something like this

round (fromIntegral x / fromIntegral y)

round is one of several functions that transform numbers to integers.


    Prelude> 5 `div` 2
    2
Haskell's doing the right thing here by having a separate function for integer division. It makes no sense to overload / to mean both regular and integer division.


With that reasoning, assembly shouldn't be possible to write correctly.

In other words, because I'm not dumb?


I'm not saying you will write nonsense, I'm asking what evidence you have. The evidence in this case is "I know what I'm doing".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: