Earlier quoted context omitted.
I think you've stated the main Snap vs. Yesod distinction in Haskell-land: "here are some tools" versus "do this." There's advantages to each approach, and luckily there are solid Haskell frameworks for both.
Maybe Sorta. Most of Yesod is also reusable libraries, for example I've used Hamlet to generate HTML without using any of the rest of Yesod.
The Haskell / Snap ecosystem is as productive (or more) than Ruby/Rails.
91–100 of 104 posts
Re: The Haskell / Snap ecosystem is as productive (or more) than Ruby/Rails.
#92Earlier quoted context omitted.
Maybe Sorta. Most of Yesod is also reusable libraries, for example I've used Hamlet to generate HTML without using any of the rest of Yesod.
Sure, but if you want a Preferred Way, like the OC seems to, Yesod's your huckleberry. Right? Or is that not so?
Re: The Haskell / Snap ecosystem is as productive (or more) than Ruby/Rails.
#93Earlier quoted context omitted.
This is IMHO far more useful and interesting comparison than the original article; thanks for taking the time to write it. I think the concrete examples really help show up the differences between the languages here. I might quibble with your initialisation in ruby (I'd expect it to be initialised with a string and hide the internal representation), but it is clear here why the Haskell type system might help you avoi…
I would argue that the compilation step is what is responsible for finding errors at compile time rather than runtime, but then the type system is perhaps required to enforce that. It is. A Ruby (or Python, or JavaScript, ...) source code inspector cannot, in general, infer concrete types for variables. You're allowed to say (JS example) var x = "fred"; x = 3; and now, if you try to write a JavaScript inspector to in…
The bit where dynamic languages get really complicated is that they allow for you to use types that hadn't been taken into consideration when the language was designed. For example, in Python you can write code using duck typing and it will Just Work(TM) but if you want to do something equivalent in Haskell you would need tell GHC to use one of those weird language extensions just to have the program typecheck. The monkeypatching you mention goes more along this line, I think.
Re: The Haskell / Snap ecosystem is as productive (or more) than Ruby/Rails.
#94Until it has produced as many sites, I consider any such statements as anecdotal. That is, I'd rather measure a system's productivity with actual production in the wild than with any of the systems "inherent" capabilities. It might be productive for the author, but I don't see the general web programming public finding it more productive. People have learned Ruby to use Rails, but not many have ventured to learn Hask…
So basically vanilla PHP has won in your opinion, with Ruby not even being a small glimpse on the map?
If we are to held an idealist view, no. But it would just be ideology making up for a lack of the same volume of production being done with Ruby compared to PHP.
Remember the "worse is better" motto? Worse could also be more productive.
Now, I don't care why PHP is more productive in actual volume of production --instead of more productive as in "it makes you more efficient". It could be because of "stupid" programmers that cannot adapt to Ruby, because of inertia, because it is fast to start with, because it has a more vibrant ecosystem than Ruby/RoR, because of large amounts of code already built with it used to bootstrap newer projects, because of lack of RoR publicity, because of just being there first, etc etc. Thing is: by usage and number-of-sites metrics, it is.
Re: The Haskell / Snap ecosystem is as productive (or more) than Ruby/Rails.
#95Until it has produced as many sites, I consider any such statements as anecdotal. That is, I'd rather measure a system's productivity with actual production in the wild than with any of the systems "inherent" capabilities. It might be productive for the author, but I don't see the general web programming public finding it more productive. People have learned Ruby to use Rails, but not many have ventured to learn Hask…
It's not as popular therefore it's not as good. Your logic is definitely valid!
And your logic is definitely faulty. I've never used the word "good"
What I said is "more productive" (what the author claims) can only be measured in actual PRODUCTION.
That is, the important thing is not:
(a) "If I were to use X framework/language, how productive would I be over Y framework/language?",
but:
(b) "In an actual empirical observation, what framework/language is actually responsible for the largest volume of production?"
The author talks about (a), and advocates Haskell. But that is not an empirical, scientific, measurable observation, it's just his personal opinions, feelings and anecdotes. Only (b) gives an actual overall metric of the productivity of two frameworks/languages combos.
Even having the same person doing the exact same project with both X and Y framework/languages and comparing the speed with which each was done, would tell us very little. Maybe someone he was more comfortable with one or the other, maybe that particular project fitted especially X over Y, maybe it didn't need to communicate with legacy stuff with neither X nor Y do well, etc.
The only way to tell what generally was for production for the majority of people, is to, DUH, see what the majority of people have used for their productions.
Re: The Haskell / Snap ecosystem is as productive (or more) than Ruby/Rails.
#96Earlier quoted context omitted.
You can start with simple types in Haskell too, FWIW. To take your phone number example, let's say I'm making a very simple program that dials a number. In Ruby, I'm talking about something like: aNumber = "+0123456789" def dial(number) # does the dialling return someConnection end dial(aNumber) (It's been a long time since I've done any Ruby, so forgive any glaring syntax faults.) That method expects a string - aNum…
Just a reminder of duck typing: Haskell style => function applied to parameter, e.g f(x) Ruby duck type style => parameter applies function to itself e.g x.f() An example: module Dialable def dial # do stuff with self puts "Dialling..." end end # I wouldn't do this, but... class String include Dialable end # So, phone number as a string can be dialled my_phone_number = "01 23 45678" my_phone_number.dial Dialling... #…
Re: The Haskell / Snap ecosystem is as productive (or more) than Ruby/Rails.
#97Earlier quoted context omitted.
You can start with simple types in Haskell too, FWIW. To take your phone number example, let's say I'm making a very simple program that dials a number. In Ruby, I'm talking about something like: aNumber = "+0123456789" def dial(number) # does the dialling return someConnection end dial(aNumber) (It's been a long time since I've done any Ruby, so forgive any glaring syntax faults.) That method expects a string - aNum…
Great explanation. I don't know enough Haskell to form my own opinion of some of your points, but I have a feeling that will soon change. Thanks for taking the time to write this.
Re: The Haskell / Snap ecosystem is as productive (or more) than Ruby/Rails.
#98Having a compiler that will tell you all the places that you need to change things is an amazing productivity booster. Agree with this 100%. I think dynamically typed languages are a transitional technology we'll mostly leave behind as the kinks get worked out of modern type systems.
It would have been interesting (and perhaps a little more convincing) to see some examples of the Haskell type system boosting productivity in such a dramatic way. I can count on one hand the number of type issues which have caused trouble for me in Ruby over > 5 years of producing complex systems with it. I haven't used Haskell though so would be interested to see some examples of this. If his audience is Ruby users…
Re: The Haskell / Snap ecosystem is as productive (or more) than Ruby/Rails.
#99Earlier quoted context omitted.
You can start with simple types in Haskell too, FWIW. To take your phone number example, let's say I'm making a very simple program that dials a number. In Ruby, I'm talking about something like: aNumber = "+0123456789" def dial(number) # does the dialling return someConnection end dial(aNumber) (It's been a long time since I've done any Ruby, so forgive any glaring syntax faults.) That method expects a string - aNum…
This is IMHO far more useful and interesting comparison than the original article; thanks for taking the time to write it. I think the concrete examples really help show up the differences between the languages here. I might quibble with your initialisation in ruby (I'd expect it to be initialised with a string and hide the internal representation), but it is clear here why the Haskell type system might help you avoi…
I kind of agree with your second sentiment - but I did want to point out that it's entirely possible to write a dynamically typed compiled language too.
It boils down to type systems: weak/strong, and dynamic/static. C, for instance, is weak/static: you define types, but you can basically pass around whatever you want to:
#include
int main(int argc, char* argv[]) {
int result = add(1, 2);
printf("%d", result);
return 0;
}
int add(int a, char b[]){
return a + b;
}
The above will happily compile - and run. The method header for "add" says it takes an integer and a character array - essentially, a String in C (for people who actually use C: I've avoided pointers because they're confusing, and my C is even rustier than my Ruby).Inside that method though, I do something entirely braindead: I add the integer and character array as if that were an operation that makes sense. Then I call "add" with two integers anyway, and let it do what it wants. It actually does return 3: rather than throwing a runtime error to say "hey, this is stupid, I should have a String here and you can't add a String to an integer!", it just trundles merrily along. A strong type system wouldn't let you compile or run this: it'd tell you off for trying to call a function with invalid arguments, then (hopefully) tell you off for using "+" in a nonsensical way.
FWIW, the following also works:
#include
int main(int argc, char* argv[]) {
int result;
char aString[] = {'h', 'e', 'l', 'l', 'o'};
result = add(1, aString);
printf("%d", result);
return 0;
}
int add(int a, char b[]){
return a + b;
}
The number returned and printed here is derived from the location in memory of the characters you've written. I think. Either way, it makes no sense (for most people, anyway - C hackers may have some use for such an operation).At the other end of the spectrum, Python and Ruby are strong/dynamic: you can pass whatever types around you want, but the interpreter will crash if you try to do something the type system doesn't allow. You can't do 1 + "test": it makes no sense. It won't even try to run it and return something nonsensical, it just won't run.
All that said: I don't know if there are any strong/static languages without a compiler. I can't seem to think of an application of such a language: the best way to exploit a strong/static type system is to have it tell you, up-front, that you've made a mistake (and, of course, have your compiler optimize the pants off your code for runtime).
I also don't know of any languages which are compiled, but fully dynamically typed (Scala, maybe? Although it allows static typing too). Considering the benefits you can gain from type analysis during compilation, again, the concept seems a bad fit. Although (same as in the previous example), you could happily write a language that is!
So, yes, compiling the code is what enables you to perform those checks - but a strong type system is a part of compilation in its own right :).
Re: The Haskell / Snap ecosystem is as productive (or more) than Ruby/Rails.
#100Earlier quoted context omitted.
It's amusing that in a thread about the advantages of Haskell, immutability is being identified as the largest failure a language has made. I don't think immutable Strings are a bad idea but I do think it's unfortunate that Java: - Made Strings immutable, used them everywhere, and only later worked out that perhaps CharSequence would have been better in a lot of places. - Didn't provide a sensible way to handle Objec…
A class being final means that you can't derive from it in Java, not that instances of the class are immutable.