Live data from Hacker News

I tried Haskell for 5 years

metarabbit.wordpress.com

261–270 of 273 posts

Re: I tried Haskell for 5 years

#261

Earlier quoted context omitted.

The C is very straightforward. Maybe you meant C++? You see no complaint because noone use that anymore. Anything that can be done with an easier language is done with an easier language. The hardcore C++ performance critical code is left to a few veterans, who don't complain.

I don't consider the combination of the C runtime + the machine model straightforward - just less arcane than C++. Consider pipelines and branch prediction and cache lines and it quickly becomes difficult. Granted, those typically become relevant later in the optimization stage than other things.

Pipelines, branch prediction and caching are not part of the C runtime. And unlike Haskell, C makes it easy to look at the assembly for a piece of code, evaluate it for the machine it's running on, and fix these problems when they come up. C is not generally adding additional burdens, especially not ones that a higher-level language like Haskell won't also be adding to a far greater degree.

Re: I tried Haskell for 5 years

#262
post #110
post #105

Earlier quoted context omitted.

Hi can you tell us a bit more about this SQL-related project? I'm rather practically interested.

I work for www.sqream.com, and our main product is SQream DB. SQream DB is a GPU SQL database for analytics. Everything was written in-house - from the SQL parser all the way down to the storage layer. We're designed to deal with sizes from a few terabytes to hundreds of terabytes, and we use the GPU to do most of the work. It is the compiler (written in Haskell) however, that decides about specific optimizations and…

> www.sqream.com

I don't like having to be that guy, but your landing page hijacks scrolling (which always causes problems; I noticed first because it broke ctrl-scroll zooming), downloads a 30MB video in a loop, forever, takes a significant amount of CPU even when the video isn't in view and the tab is not active, and despite having almost no content manages to take far more memory than any other non-email tab I have open.

Re: I tried Haskell for 5 years

#263
post #110

Earlier quoted context omitted.

I work for www.sqream.com, and our main product is SQream DB. SQream DB is a GPU SQL database for analytics. Everything was written in-house - from the SQL parser all the way down to the storage layer. We're designed to deal with sizes from a few terabytes to hundreds of terabytes, and we use the GPU to do most of the work. It is the compiler (written in Haskell) however, that decides about specific optimizations and…

> www.sqream.com I don't like having to be that guy , but your landing page hijacks scrolling (which always causes problems; I noticed first because it broke ctrl-scroll zooming), downloads a 30MB video in a loop, forever, takes a significant amount of CPU even when the video isn't in view and the tab is not active, and despite having almost no content manages to take far more memory than any other non-email tab I ha…

Our website is... Yeah... I know... :/

I've passed on your comments in any case, but know that we're in the process of rebuilding the website from scratch.

Re: I tried Haskell for 5 years

#264
post #227

Earlier quoted context omitted.

mfix is somewhat low-level. It’s used in the desugaring of Haskell’s “do rec” notation. I find it useful because it lets me take a recursive structure[1] and a multi-pass algorithm[2] on that structure, which involves side effects[3], and express it in code as a single pass, without mutation. This conversion of multi-pass algorithms to a single pass while retaining time/space complexity guarantees is one of the key b…

I'd love to hear more detail about the example you give of type inference over an AST. I like the idea, but I'm having trouble envisioning how to write code in that style cleanly. Did you implement that in an open source project I could take a look at?

It’s not the prettiest code, but here:

https://github.com/evincarofautumn/kitten/blob/8a7e949f1af71...

The key line is:

    (term', t, tenvFinal) 
In “inferType”, I just annotate each term with “Zonk.type_ tenvFinal type_” as I go, in the same pass as generating the type constraints. Since “tenvFinal” is the final type environment, and “zonking” substitutes all type variables with their solved types, everything gets lazily resolved when reading the annotated types later on, e.g., during analysis & codegen.

Re: I tried Haskell for 5 years

#265
post #227

Earlier quoted context omitted.

I'd love to hear more detail about the example you give of type inference over an AST. I like the idea, but I'm having trouble envisioning how to write code in that style cleanly. Did you implement that in an open source project I could take a look at?

It’s not the prettiest code, but here: https://github.com/evincarofautumn/kitten/blob/8a7e949f1af71... The key line is: (term', t, tenvFinal) In “inferType”, I just annotate each term with “Zonk.type_ tenvFinal type_” as I go, in the same pass as generating the type constraints. Since “tenvFinal” is the final type environment, and “zonking” substitutes all type variables with their solved types, everything gets lazil…

Thanks, that helped me understand better. That's really cool!

Re: I tried Haskell for 5 years

#266

Earlier quoted context omitted.

I bought a few Haskell books but could never really grok it. In the last couple years I started learning f# and have found it's an incredible "intro to Haskell" language. I opened one of my Haskell books the other day and realized I understood everything much more quickly.

F# is a beautiful, pragmatic, functional programming language. It's a shame some people dismiss it due its Microsoft origins.

Yeah, F# feels like Don Syme looked at ocaml and haskell and applied a bit of yagni and tossed in some other useful conventions (I'm sure many others were involved as well).

It drives me crazy that Microsoft doesn't push it harder from an investment perspective. They don't even write books about it :)

Re: I tried Haskell for 5 years

#267
post #253

Earlier quoted context omitted.

If you know where you're creating too many thunks, and you force them as you create them, they don't accumulate. Translation: if you've internalized the way Haskell code is compiled and executes, so that you can easily reason about how lazy evaluation is actually implemented, you can solve these problems. If not, it devolves to throwing !'s in and praying. Which is basically my point. If I don't have a hope of solvin…

I think there are different types of space leaks: - Reference is kept alive so that a computation can't be streamed. Easy to figure out with profiling but fixing them might make the code more complex. Also, if you have a giant static local variable ghc might decide to share it between calls so it won't be garbage collected when you'd expect it. - Program lacks strictness so you build a giant thunk on the heap. This i…

> I don't find it that difficult to fix once the location is known but figuring that much out can be seriously annoying.

To be clear, I agree with this. Easy to fix once you know where it is, if you're competent in the language. Occasionally very hard to know that.

Re: I tried Haskell for 5 years

#268
post #126

Earlier quoted context omitted.

I think a lot of Haskeller's will find Elm's type system to be limited and frustrating. Even for simple things the solution in Elm is that you have to write a bunch of boilerplate.

I had this experience. However, starting out I think it'd be a much more gentle introduction. For other haskellers, Purescript seems to solve this problem.

I haven't gotten to give PS more than a cursory look but the row polymorphism and structural typing seems to really compliment JS semantics.

Re: I tried Haskell for 5 years

#269

Earlier quoted context omitted.

but it's not that different than what you'd get with other programming languages. Until you have to solve a (maddeningly common) space leak issue. That's a problem unique to lazily evaluated languages (basically Haskell) and is godawful to debug. It reminds me of solving git problems... you suddenly find yourself having to tear back the abstraction layer that is the language and compiler and start thinking about thun…

> Until you have to solve a (maddeningly common) space leak issue. Hm, I've been making useful things with Haskell for a couple years including quite a few freelance projects and haven't encountered many space leaks. Definitely not enough to say they are maddeningly common, or even enough to say they are common.

My experience tracks yours.

Re: I tried Haskell for 5 years

#270

Earlier quoted context omitted.

F# is a beautiful, pragmatic, functional programming language. It's a shame some people dismiss it due its Microsoft origins.

Yeah, F# feels like Don Syme looked at ocaml and haskell and applied a bit of yagni and tossed in some other useful conventions (I'm sure many others were involved as well). It drives me crazy that Microsoft doesn't push it harder from an investment perspective. They don't even write books about it :)

There are books out there. For new language adoption, F# do have new features like Type Providers. However, it's not the best language in X for X in ['data science', 'distributed system'] etc.
Post reply on HN