These are chat archives for got-lambda/expression
The online hangout for Göteborg Functional Programming Group and everybody interested.
x => x + 1for ints).
@Jell I like your essay. I like the sensible tone of it. You're reasoning, not evangelising. (I'm at the same time both very bored and provoked by evangelists.)
I didn't read the article very carefully (It really is a bit long, maybe a summary of the different section in the introduction would be a good idea?)
I agree with what seems to be your main points
I read an interesting article some time ago about the value of static types. Perhaps it would interest you (despite the title it really isn't bigoted at all, for example it contains a long list of the costs of a static system): http://www.draconianoverlord.com/2010/11/24/why-im-a-static-typing-bigot.html
Dynamic-static Hybrid languages
Have your considered dynamic-static hybrid languages? To me it seems that this could give many of the benefits of a static type system, while only a getting a little of the cost. There is a nice little language that is called Fantom which takes this approach. It want to improve on Java by making simplifications and making it easier to use dynamic types. It is like the total opposite of Scala, fixing Java by taking inspiration from Ruby and Python instead of from Haskell.
Sadly, almost no one is using it.
Some minor thoughts and nit-picking
That’s not how euclidian distance works though, those are not very useful comparison.
I use to think about these kind of relationships as Euclidean distances in a multi-dimensional space. Maybe that makes sense.
Because Haskell relies on the knowledge that a function is pure to perform all sorts of optimisations, which is really good for performance. Like in our code above, it chooses to memoize the execution of foo11 because its type signature says it’s pure.
I wouldn't really say this this is an "optimisation" which the compiler "chooses" to do, since this memoisation is a specified part of the language semantics.
@Zalastax Interesting. Does TypeScript have non-tagged union types, like Ceylon? Haskells data type are also unions, but you have to declare them and have special tags for each case, that is kind of a different thing.
The whole point of union types is the be able to tell the objects apart at runtime... But that doesn't mean that you can tell what runtime type an arbitrary value has... For example:
fn1 :: (Int | Bool) -> Bool -- Inside this function your can tell if the argument is Int or Bool fn2 :: a -> a -- But you can't in this function, its argument doesn't have a union type
fn2. But that is not because of the union types.
idfunction. I don't know it there are languages like that, though...
is it really true that memoization is part of the language spec?
Eh, maybe I'm mixing it up... It is the values that are always "memoised" as part of the spec, (what they call call-by-need). The functions can probably be memoised as a optimisation by the compiler. You're right, sorry!
@Jell I don't know how your example with
foo11 = unsafePerformIO ... would behave...?
I would guess that, by the language standard, it would be evaluated only once. The value of
foo11 would be a thunk, which after first evaluation would be replaced by the resulting value. Have to try this out.
I think that the story for functions with arguments is different, though.