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

> I'm not sure you could just 'turn off' the type system in Haskell and have anything even remotely sensible, for example.

You can actually do exactly this:

https://ghc.haskell.org/trac/ghc/wiki/DeferErrorsToRuntime

Of course, the type system doesn't vanish but checking types is deferred until runtime, turing Haskell into a dynamic language with an unusually elaborate tag system.



It's still not comparable to a dynamic language however. Simply constructing a list [1, "Hello"] will already produce an error. Dynamic languages usually allow this, and only signal errors when the values are used in an erroneous manner, like 1 + "Hello". It does exactly what it says on the tin: it displays type errors that were found at compile time with the same type system that regular Haskell uses, but the actual displaying is deferred until run time. There is no actual tag checking going on at run-time.


It does make Haskell a dynamic language, but also isn't really what's meant. Generally when people compare statically typed languages and dynamically typed languages, what they are doing is comparing the various ways in which the type system imposes restrictions.

The way in which Haskell differs most strongly and obviously from Ruby is not that it catches the type errors at compile time - but that the type errors can be caught at compile time. This in general allows smarter tools - compare Eclipse for Java and the 'type hierarchy', 'find method calls', many refactoring calls and the far less rich tools available for Python.




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

Search: