Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
tmhedberg
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
16 ms
·
91.
▲
by
tmhedberg
14y ago
True, depending on your language, you can probably get the imperative version to be shorter than my pseudo-C implementation. But that accumulating function you're passing to reduce? That's essentially just a JavaScript version of the bind (
92.
▲
by
tmhedberg
14y ago
Let's say I have several functions I want to compose, feeding the result of one as the argument to the next. But each of these functions has some failure condition, which, if it occurs, causes the function to be unable to return a normal re
93.
▲
by
tmhedberg
14y ago
If we look at an impure language like JavaScript through Haskell-colored glasses, essentially every line of code in a JS program is automatically in the IO monad. Haskell's bonus is that it gives you the frequently-exercised option of writi
94.
▲
by
tmhedberg
14y ago
You realize that the code given in SICP is Scheme, not CL, right?
95.
▲
by
tmhedberg
14y ago
How likely is this hypothetical cleanup of JavaScript to happen, though? It seems about as likely to me as the likelihood of Haskell replacing C++ or Java; i.e. not very likely at all (even though I share your opinion that it would be a won
96.
▲
by
tmhedberg
14y ago
I agree with you on static typing and functional style being strongly preferable, and that Python makes that style of programming irritatingly difficult, but it's not like JavaScript has static typing or pattern matching either, so it seems
97.
▲
by
tmhedberg
14y ago
Perhaps C++ is mostly a superset of C in a technical sense, but in practice, it comes with its own idioms, its own conventions, its own design patterns, and its own culture, all very distinct from those of C. There's far more to consider wh
98.
▲
by
tmhedberg
14y ago
If you have function application, then you don't truly need a primitive conditional. You can represent Boolean values and conditional functions with the Church encoding [1]. This is how conditionals are represented in, for instance, the lam
99.
▲
by
tmhedberg
14y ago
Awful and awesome at the same time. It reminds me quite a bit of FizzBuzz implemented in Haskell's type system ( http://blog.omega-prime.co.uk/?p=28 ).
100.
▲
by
tmhedberg
15y ago
Agreed. LYAH is fantastic for forming a conceptual foundation, but if there's one thing it lacks, it's exercises, so it's definitely a good idea to supplement it with something more focused on writing actual code. Write Yourself a Scheme
101.
▲
by
tmhedberg
15y ago
While that's an interesting read and fun mini-project, I wouldn't recommend it as a tutorial for Haskell beginners. You need to have a pretty decent handle on the language before a lot of it will make sense. Learn You a Haskell for Great G
102.
▲
by
tmhedberg
15y ago
I can't speak for the poster you're replying to, but in my personal opinion, monads exist at a higher level of abstraction than most people, even experienced imperative programmers, are accustomed to. The formal definition of a monad is qui
103.
▲
by
tmhedberg
15y ago
In addition to the Debug.Trace facility that others have mentioned, it's also worth noting that GHCi has a built in debugger. I find that I need it pretty infrequently, since you can inspect anything defined at the top level simply by loadi
104.
▲
by
tmhedberg
15y ago
OK, fair enough. Though I'm not quite sure what you mean by "thinking about tools". If you're referring to the language as a tool, I personally haven't found that I spend more time thinking about the language when using Haskell than I do wh
105.
▲
by
tmhedberg
15y ago
The fact that Haskell is always curried means that you always have to be aware of currying. No, you don't. That was my point. By pretending that functions aren't curried, you're limiting yourself to a subset of the language's full express
106.
▲
by
tmhedberg
15y ago
I can't answer you with any real authority, since I haven't used OCaml. But from what I understand, it lacks type classes, which are absolutely central to the richness of Haskell's type system. Whether or not it makes up for this in other w
107.
▲
by
tmhedberg
15y ago
Agreed; after getting used to working with Haskell's type system, I've found it kind of painful to use languages with weaker, less expressive type systems (which unfortunately, is basically every practical language other than Haskell). The
108.
▲
by
tmhedberg
15y ago
Currying isn't a big deal for python programmers. The article fails precisely because it makes currying into a big deal. I wasn't trying to imply that currying is a big deal for most Python programmers, nor do I agree that the article was
109.
▲
by
tmhedberg
15y ago
This argument seems silly to me. Currying is the name of the technique. Why is that scary? Should he call it something different just to avoid "scaring" feeble programmers who are afraid of new words?
110.
▲
by
tmhedberg
15y ago
This kept backscatters from being deployed for the most part; have you ever seen one? I don't fly very frequently, but my understanding is that nearly all airports in the US now have them. Is this incorrect? Nobody likes waiting in line
111.
▲
by
tmhedberg
15y ago
I'm pretty sure that the author of the article didn't mean to imply that you should actually define monads explicitly in Python and start using them in your code. That would be inelegant, far from idiomatic, and mostly pointless, since Pyth
112.
▲
by
tmhedberg
15y ago
The advantage to Haskell's type constructor approach, though, is extensibility. Making nullability a language keyword like `const` requires a change to the fundamental grammar of the language. In Haskell, `Maybe a` is just another data type
113.
▲
by
tmhedberg
15y ago
> wouldn't it be better to a) code f defensively in the first place, In Haskell, you don't have to. If your function takes a String as an argument, for instance, the compiler will ensure that it never receives a null instead. It will al
114.
▲
by
tmhedberg
15y ago
Sorry for not being clear. That's just the (abbreviated) type signature of >>=, which is formally written as (>>=) :: Monad m => m a -> (a -> m b) -> m b It's not the definition of >>=, t
115.
▲
by
tmhedberg
15y ago
Perhaps the author is just glossing over the bigger picture for the sake of explanation, but it's a bit of a narrow view of monads to say that they are just "conditional function calls". That's true if the monad in question is Maybe, Either
116.
▲
by
tmhedberg
15y ago
My MUA (Mutt) can launch any editor you like for composing mail. I use Vim, but it would work equally well with Emacs, nano, or whatever you prefer. Mutt is not alone in this regard. The point is, you don't have to have embed your MUA insid
117.
▲
by
tmhedberg
15y ago
From the Pentadactyl home page: "Pentadactyl was once called Vimperator, initially written by Martin Stubenschrott, then developed and maintained by Doug Kearns, Kris Maglione, and several other invaluable contributors. Doug and Kris, the p
118.
▲
by
tmhedberg
15y ago
You can also accomplish the same thing with: sudo sysctl -w vm.drop_caches=3
119.
▲
by
tmhedberg
15y ago
This is a little bit disingenuous. I can certainly see the point that all of this separation is unnecessary on a typical modern desktop system, but several of the paths you listed in support of your argument are not actually specified by th
120.
▲
by
tmhedberg
15y ago
I'm curious, what is your opposition to `/usr/share`? It seems quite logical to me as a place to store non-executable, read-only, shareable data like man pages and other documentation, fonts, keymaps, color profiles, game data, etc. Where e
More ›