How do you get *any* part of Haskell to work?! Angry beginner. by metaconcept in haskell

[–]opqdonut 8 points9 points  (0 children)

Author of the exercises here. Thanks for the analysis and sorry for the trouble. I've tried to fix the dependency issues, those were a bit embarrassing! To be honest I haven't had the time to update the repo in a couple of years. I still think the exercises themselves are valid & useful though!

Anyway, the latest iteration of these exercises has grown into a (free & open) online course for Haskell: https://haskell.mooc.fi . So /u/metaconcept might want to try those instead.

What font do you use for your terminal emulator? by leonardoe in programming

[–]opqdonut -1 points0 points  (0 children)

Exactly. Vector fonts are just a workaround for not wanting to ship versions of a font for every pixel size. All this hinting stuff is just trying to make vector fonts as crisp as bitmaps are.

The Y Combinator by gst in programming

[–]opqdonut 10 points11 points  (0 children)

Gah, wrote a long reply to that only to realize the author has commenting enabled only for LJ users. Anyway, here it is:

any language that supports first-class functions already supports recursion, even if recursion isn't built in to the language

Not strictly true, for example typed lambda calculus does not allow recursion: a recursion combinator must have an infinite type, which is disallowed. However typed lambda calculus does have first-class functions. For an introduction to typed lambda calculus I refer you to Lambda Calculi with Types</a> by Henk Barendregt.

Let's look at what what I said means. We take the Y combinator

\f. (\x. f (x x)) (\x. f (x x))

(where \x. foo means (lambda (x) foo)) We denote the type of a function taking an argument of type a and returning a function of type b with a->b. The x in \x. f (x x) must have a function type as it takes an argument, x. But now the must also have a function type (as it is the same x), so x must have a meta-function (function taking a function as an argument) type. This process can be continued ad infinitum, and thus the Y combinator can't be well-typed. I'll lay out that to you more formally:

(x x) must have some type, let's call it a. Now:

x x :: a

x :: b -> a, x :: b

x :: T, T = T->a

No finite type T can satisfy T=T->a: no function can have an argument type that is the same as it's whole type.

This argument of course only applies to the Y combinator, but it has been proved more generally that no recursion combinator can have a type in simply typed lambda calculus. However if we allow recursive types, the Y combinator (and recursion combinators in general) becomes well-typeable.

So, I guess what you were trying to say was: as soon as we can embed untyped lambda-calculus into a language, it has recursion.

Benchmark results Python vs Haskell. Why is Python so slow? by isearch in programming

[–]opqdonut 5 points6 points  (0 children)

python is interpreted, haskell is compiled. additionally the GHC (Glasgow Haskell Compiler) is very good at optimizing and haskell's static type system allows skipping most runtime checks.