Live data from Hacker News

Translating Haskell to C++ metaprogramming

vandenoever.info

41–50 of 63 posts

Re: Translating Haskell to C++ metaprogramming

#41
post #36

Why is there no usable haskell SSL library? It would seem this is an area where the claims about haskell eliminating whole classes of bugs and so on would really be worthwhile and an amazing advert for haskell advocates. The claims about being able to formally prove the code implements the spec would be pretty damn compelling in that space too. Once upon a time I asked on HN if there are any useful and usable haskell…

Pandoc (document format converter) comes to mind.

Re: Translating Haskell to C++ metaprogramming

#42
post #36

Why is there no usable haskell SSL library? It would seem this is an area where the claims about haskell eliminating whole classes of bugs and so on would really be worthwhile and an amazing advert for haskell advocates. The claims about being able to formally prove the code implements the spec would be pretty damn compelling in that space too. Once upon a time I asked on HN if there are any useful and usable haskell…

Pandoc (document format converter) comes to mind.

It seems to have come to harry8's mind too.

Re: Translating Haskell to C++ metaprogramming

#43
post #36

Why is there no usable haskell SSL library? It would seem this is an area where the claims about haskell eliminating whole classes of bugs and so on would really be worthwhile and an amazing advert for haskell advocates. The claims about being able to formally prove the code implements the spec would be pretty damn compelling in that space too. Once upon a time I asked on HN if there are any useful and usable haskell…

Firstly, the entire classes of bugs that Haskell eliminates are not classes that are especially relevant to cryptography.

Secondly, if you know where someone has claimed that Haskell lets you "formally prove the code implements the spec" then please point it out to me so I can challenge them for being misleading at best.

Re: Translating Haskell to C++ metaprogramming

#44
post #36

Why is there no usable haskell SSL library? It would seem this is an area where the claims about haskell eliminating whole classes of bugs and so on would really be worthwhile and an amazing advert for haskell advocates. The claims about being able to formally prove the code implements the spec would be pretty damn compelling in that space too. Once upon a time I asked on HN if there are any useful and usable haskell…

git-annex

cryptol (https://en.wikipedia.org/wiki/Cryptol)

seL4 (https://en.wikipedia.org/wiki/L4_microkernel_family#High_ass...)

Re: Translating Haskell to C++ metaprogramming

#45

Earlier quoted context omitted.

I disagree on the for loops claim. A well written for loop is generally a decomposed pipeline of an optional filter/takeWhile plus a map plus an optional reduce. Easy-to-edit for loops separate those concerns. Easy-to-edit functional programs separate those concerns. It's all the same. As far as "you can see how a function depends on global state by looking at its argument list" you are actually referencing systems t…

A function that takes a database connection as a parameter does use global state, the state in question being the world outside the process. If you want some convincing about the for loops claim, well, first I recommend considering how keyboard users often overlook cases where using a mouse would be more efficient, and then I recommend trying some programming contest like the Google Code Jam using Haskell. Then try u…

> some people from IRC got me to try the Code Jam. I thought I'd use Haskell, being very familiar with it, and the experience was a most illuminating disaster. On the other hand, C++ worked out pretty well, even though I was a total cargo cult functional programming weenie at the time and had a real bad attitude about C++

Were you familiar with pure functional data structures and algorithms or at least simulating imperative ones with ST when needed? If not, I don't think you can fairly say that Haskell is bad for programming contests whereas C++ worked out pretty well.

You at least need to compare the two with an equivalent knowledge of implementing algorithms with each, not that figuring out or even approximating that equivalence would be easy .

> You'll find yourself much more aware of how much time you spend stumbling over functional code after that.

I'm well aware of when/how much I stumble over functional code since I still have vastly more experience with the imperative paradigm.

All I can do is try and keep an open mind to logical arguments and keep writing code in multiple languages and multiple paradigms to know what the best answer is for a given scenario or set of scenarios.

> how keyboard users often overlook cases where using a mouse would be more efficient

Don't see how this is relevant, but I'll bite... what cases would this be? I of course agree that gaming or navigating a 3d world is better with a mouse, but I struggle to see where programming related tasks would be better suited to using mouse.

Re: Translating Haskell to C++ metaprogramming

#46

Earlier quoted context omitted.

> Haskell's perceived as an impractical language because it is one †. Theoretically maybe ;) The real world disagrees with you however: https://www.fpcomplete.com/business/haskell-industry/ https://wiki.haskell.org/Haskell_in_industry > At the line-by-line level, purely functional code also takes more effort to edit, once written, than imperative code. How? You can locally reason about purely functional code which ma…

You link two cherry picked pro-Haskell links as proof that "the world believes that Haskell's is totally practical language"? Good grief.

I was never trying to prove "the world believes that Haskell's is totally practical language".

My response was purely a rebuttal to:

"Haskell's perceived as an impractical language because it is one"

The "cherry picked pro-Haskell links" were picked because they link to examples of Haskell's practical uses in industry.

Should I have created a faulty rebuttal that didn't list real world counter-examples of "Haskell's perceived as an impractical language because it is one"?

I don't think I could find a link to practical uses of any language in industry that wasn't "cherry picked".

Re: Translating Haskell to C++ metaprogramming

#47
post #36

Why is there no usable haskell SSL library? It would seem this is an area where the claims about haskell eliminating whole classes of bugs and so on would really be worthwhile and an amazing advert for haskell advocates. The claims about being able to formally prove the code implements the spec would be pretty damn compelling in that space too. Once upon a time I asked on HN if there are any useful and usable haskell…

> Why is there no usable haskell SSL library?

Probably because of the broad agreement among crypto people that reinventing core crypto wheels is almost always a bad idea. On top of that, the intersection between the set of people who are qualified to write that crypto code and the set of people who know Haskell well enough to do a good job of it is probably the empty set.

Re: Translating Haskell to C++ metaprogramming

#48
post #5

Earlier quoted context omitted.

I don't know why people don't just use Haskell. Because perception is everything in this business. Haskell is perceived to be an impractical, academic language. Therefore, people refuse to use it and instead try to translate lessons they learned from it to "more practical" languages such as C++. If everyone was working solo and didn't need to justify their decisions to others, maybe Haskell would catch on faster. As…

Haskell's perceived as an impractical language because it is one †. There aren't many projects where you'd get any plausible benefit from using Haskell instead of some other reasonable garbage collected language. Lazy evaluation is a big risk, if you aren't writing programs that start and finish. It sure is one that I've suffered from. At the line-by-line level, purely functional code also takes more effort to edit,…

> Lazy evaluation is a big risk, if you aren't writing programs that start and finish.

No it is not. I've been writing Haskell full-time for five and a half years and I can count on one hand the number of times that lazy evaluation has been a significant problem.

> At the line-by-line level, purely functional code also takes more effort to edit, once written, than imperative code.

This couldn't be further from the truth. Haskell's ease of maintenance is vastly better than every other language I've used because of purity and its much more advanced type system. I've had a colleague make a highly non-trivial sweeping change to a 2500 line application I had written that they had not worked with before and their change worked literally the first time they got it to compile. This is not one of those statements of "if it compiles, it works", which are obvious hyperbole to make a point. It's an actual experience I've had that happened exactly that way. My coworker and I were rather surprised and we both agreed that there's no way that could have happened in any other language in mainstream use today. It's actually still in our commit log with the description "Godly refactoring".

Re: Translating Haskell to C++ metaprogramming

#49
post #36

Why is there no usable haskell SSL library? It would seem this is an area where the claims about haskell eliminating whole classes of bugs and so on would really be worthwhile and an amazing advert for haskell advocates. The claims about being able to formally prove the code implements the spec would be pretty damn compelling in that space too. Once upon a time I asked on HN if there are any useful and usable haskell…

Have you seen this Haskell tls[0]?

"This library provides native Haskell TLS and SSL protocol implementation for server and client."

0: http://hackage.haskell.org/package/tls

EDIT: This Github issue provides some great discussion about the security of this library and links to some good discussion as well:

https://github.com/vincenthz/hs-tls/issues/89

Re: Translating Haskell to C++ metaprogramming

#50
post #2

I don't know why people don't just use Haskell. C++'s template system has become the ugliest part of the language, both the syntax and the perverse ways people twist the language with it. I understand most of the metaprogramming tricks are in the same vein as "Look what I made in Brainfuck!", and are more about showing off than for serious consideration, but for getting real work done it's a huge headache to work wit…

> I don't know why people don't just use Haskell.

Because sadly it isn't a first class language in OS vendor's SDKs.

Even Swift and F# have more possibilities to succeed in the industry, exactly because of that.

Post reply on HN