I was solving some programming puzzles today, and found myself pining for Map comprehensions.
Maybe there should be a Comprehensible class that’s automatically mapped to comprehension syntax. It’s rather odd to have them only for lists. That would be both more general and more elegant than just bringing back monad comprehensions.
Is there any obvious reason why this wouldn’t work?
Eu sou um progressista, o que quer dizer que me subscrevo à tese basica dos progressistas mais revolucionários de que há algo de errado no mundo que deve ser melhorado. Não me considero, como é evidente pra quem me conhece melhor, parte desses revolucionários. Há uma longa história a ser contada aqui, mas o resumo da ópera é que não identificamos necessariamente os mesmos problemas no mundo, e nossos padrões de solução são diferentes.
There has been a raging debate (just watch Reddit!) on static vs dynamic typing and programming language choice these days. Most participants seem honest enough to point out the advantages and disadvantages of each typing scheme — dynamic typing requires less grunt “typing” work but is significantly less “safe” than static typing — but don’t account for the flexibility of typing usage available to each language.
While from a strict definitional viewpoint static and dynamic typing are quite disjoint — type checking is either done at compile-time or left for runtime — there are quite a few intermediate schemes. Some languages (Visual Basic, IIRC) allow for Variant data types, for example; Haskell’s own take at this seems to be Data.Dynamic, but I don’t really know for sure.
There is, moreover, even in a language disallowing variant data types, a spectrum of typing strategies that runs from no-pasaran typeful programming to just exploiting cartesian products and sums from machine types. Say you want to represent pixels in an infinite-sized 2D display; let us explore some ways of specifying that.