The Haskell type system bothers me

Submitted by metaperl on Thu, 12/07/2006 - 4:58am.

A type is a set of values. Earlier, I discussed how I had to do programming on something that was no more than a list whose elements were "consed" together via carriage returns:


"item 1\nitem2\nitem 3"

While I did manage to write an implementation of lines, the Haskell type system is reknowned for forcing programmers to describe their data up front.

But, the Haskell type system did not interpret my string as a list for me.

I think Cale said it best recently

Sometimes the static typing language just doesn't have the types necessary to express the conditions on code which the programmer would want to express, and sometimes adding those additional types will either spoil type-inference, or make the problem of proving that a program satisfies its types much harder, or even make it outright impossible for the compiler to do for itself.

In reflection, I suppose I could resort to Parsec to produce a list for me.

Submitted by Cale Gibbard on Sat, 12/09/2006 - 5:47am.

You do know that 'lines' is a prelude function, right?

Submitted by Cale Gibbard on Sun, 12/10/2006 - 1:15pm.

This is why you don't want to spend all your time programming with strings -- they tend to have very little structure. Parsers (such as lines, or fancier parsers constructed with things like parsec) exist so as to add structure to what is otherwise just a sequence of characters, at which point the type system will start having larger benefits. Unfortunately, the OS/filesystem tends not to be able to communicate with programs in any more disciplined way. It would be interesting to see an OS which supported algebraic data types at the filesystem level.

Submitted by Igren on Tue, 04/10/2007 - 9:35pm.

Aloja! Ah: asian gang bang Extreme asian gang bang in that town. asian babes Tall asian babes have gropsex. asian porn star Famous asian porn star in that clips. asian hardcore Asian hardcore is really hard. gay asian She like gay asian. asian sexy There is asian sexy in the red dress. busty asian See! Busty asian! There. asian sluts That asian sluts were splendid. Be good.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.