News for hackers. Stuff that matters.
Re:“Mostly functional” programming does not work by coolsunglasses on Sunday April 27, 2014 @07:55AM (#7654775)
I'm an experienced Clojure user with work done on the job and in open source. If you're a Clojure user, it's very likely you've used a library I've worked on or made.

Don't bother. Go straight to Haskell and just Haskell.

No excuses, no compromises, no mental backflips to justify not learning something new. Learn Haskell properly and then see for yourself why "hybrids" are a waste of time.

Hybridized approaches are like asking for a hole in your bathroom floor when you're being offered indoor plumbing with a porcelain toilet instead of an outhouse.

Re:“Mostly functional” programming does not work by cynicalkane on Sunday April 27, 2014 @12:51PM (#7655784)
I find your rant slightly insulting, off-topic, and lacks substantial information. "Learn Haskell because I say so." Why? No.

But let me do something you didn't do, which is to actually explain my position. Hybrid languages afford a flexibility and power not available to language puritans. It's very nice to have things first-class DSLs that don't rely on slow monad stacks, heterogeneous lists that don't rely on existential qualification, stateful programming that isn't a type system hack (do I really need to understand existential uninstantiated types to twiddle a bit in a vector?), first-class side-effects without monad stack weirdness (unsafe escapes don't count), Turing-complete macros at load time, inheritance and class qualification that isn't crippling and/or dependent on weird compiler extensions... In the course of learning Haskell I find myself banging my head against a type-system wall to do something that would be trivial in Clojure or Scala.

Now I like Haskell, but Clojure and even Scala offer very flexible and powerful defaults together with programming escape hatches anywhere you want them. This is very powerful. It's not clear how to have a similar in a strongly typed strict language. Monads and weird compiler extensions don't cut it.

Re:“Mostly functional” programming does not work by coolsunglasses on Sunday April 27, 2014 @09:01PM (#7657688)
A Clojure and Erlang user I got started learning recently was able to get to Applicatives in a single afternoon.

You can easily, easily spend more time debating it - learning nothing - than you would just checking it out for yourself.

If you were banging your head against the wall, you were suffering from bad pedagogy, not a bad language.

I went through the same experience! I know exactly what you're talking about, but you don't know what you're missing!

So lets stop debating and instead focus on fixing the pedagogy. You won't regret it.

Try this course: http://www.seas.upenn.edu/~cis194/lectures.html

Ping me via my email if you need help.

Re:“Mostly functional” programming does not work by cynicalkane on Sunday April 27, 2014 @09:27PM (#7657765)
Ah, the Haskell assumption that people who dislike Haskell's way of doing things just don't get it.

Why are you talking to me about Applicatives? Applicatives are easy. I'm not complaining about what the type system can do. I'm complaining about what it can't do. And it can't do a lot. For instance, it can't "safely" twiddle a bit in a vector without resorting to a compiler trick involving uninstantiable existentially typed monads. It can't produce DSLs that live outside the type straitjacket, so you get really complicated stuff, like the kudzu-like system of the Lens library, full of existential types and higher-rank types and restrictions, that still is not actually typesafe. And so on. I'm repeating myself already.

Monads and weird compiler extensions are not the same as a language that respects the programmer who wants to do something unusual. This is what I'm saying. Don't tell me about applicatives as a response. It's not a response, and it's insulting.

Re:“Mostly functional” programming does not work by coolsunglasses on Sunday April 27, 2014 @10:04PM (#7657878)
You don't appear to be here to share ideas or learn, so lets get concrete rather than posture.

When you say "uninstantiable existentially typed monads" you're showing off your knowledge and being verbose when you actually mean "ST". There's no actual problem here, you're using big words to seem impressive despite the fact that by being obscure you're condescending to them and to me. ST works the way it does so you can't accidentally leak mutable references. There's nothing particularly limiting about it beyond that. ST is like a generic transients that works for any data type instead of the blessed ones.

You don't need to care that ST is existentially typed in order to use it at all. That's like complaining about how difficult it is to weld steel so you live in a mud hut instead. Division of labor applies here because abstractions and types work in Haskell.

There's nothing wrong with twiddling bits in Haskell. I do it all the time. You're complaining that the type system won't let you lie to your users and say a side effect is

    a -> ()
    -- instead of
    a -> IO ()
I happen to think knowing which functions are pure and which are actions is a plus.

"Can't produce DSLs that live outside the type straitjacket" What? You can build a DSL on hash-maps and symbols in Haskell the same as Clojure users do. Haskell users don't do that because it sucks. ADTs and free monads are nicer.

Name-dropping lens as if it's a negative to Haskell is nuts. You're not obligated to use lens if you're still learning Haskell, but finding it difficult to use is a sign you miscalculated your knowledge.

The foundational building block of writing one's first lens is scrubbing out the (fmap . fmap) pattern, which is a use-case even Clojurians can relate to. There's no "there" there to complain about.

Your library 'clearley' would be easier to understand if it had types.

Have you considered a book like Joy of Clojure? http://www.manning.com/fogus2/ I found the first edition of Joy of Clojure improved and clarified my Clojure. Also, back off the defprotocol/defrecord in Clojure until your design is cleaner and more firmed up.

You're not here to be learn or share anything so I'm backing out of the conversation. Provided some clarity on the obtusity before parting.

tl;dr nonsense, intentionally obscure appeals to things that are "too complicated" which are comparable to refusing to drive a car you couldn't build yourself.

You can learn how to build the car later after you understand why it was engineered that way.

Re:“Mostly functional” programming does not work by caughtexception on Sunday April 27, 2014 @01:15PM (#7655887)
I am fed up with these "pure" people.

They have hijacked every sane discussion about programming into a condescending -- "Do you have monads and typeclasses ?".

It's absolutely unhealthy.

State is not Evil.

Languages like clojure, scheme take imperative features and give it more beautiful abstractions.

In what profession, do you find people complaining about the very foundations and thinking it's cool ? It's like Musicians saying Rhythm is stupid.

If you haven't written a State Machine with goto's and never marvelled at it's beauty ... please just try it.

Re:“Mostly functional” programming does not work by coolsunglasses on Sunday April 27, 2014 @09:11PM (#7657722)
>State is not Evil.

I agree!

You're mistaken if you think Haskell users don't take advantage of state or side effects. They do, you just don't understand the difference.

Try this course:

http://www.seas.upenn.edu/~cis194/lectures.html

Then see LYAH's section on the State monad:

http://learnyouahaskell.com/for-a-few-monads-more

Then reflect on ST:

http://www.haskell.org/haskellwiki/Monad/ST

Then this example using mutable variables and closures:

http://bitemyapp.com/posts/2014-03-25-when-nested-io-actions...

Side-effecting closures mutating variables!

It's not "no state or side effects".

It's about making state and side effects typed and explicit so they can be properly composed and manipulated.

Re:“Mostly functional” programming does not work by Uncompetative on Monday April 28, 2014 @08:59AM (#7659562)
> It's like Musicians saying Rhythm is stupid.

I love that sentence. It makes me think Haskell is like Bartok.

Re:“Mostly functional” programming does not work by nextos on Sunday April 27, 2014 @08:36AM (#7654829)
While I agree hybrids are in general a bad idea, some good hybrids exist. But they are extremely hard to get right. For example, Oz/Mozart:

http://www.sm.luth.se/csee/courses/timber/reading/VanRoy.pdf

http://www.epsa.org/forms/uploadFiles/3B6300000000.filename....

Re:“Mostly functional” programming does not work by MrBuddyCasino on Sunday April 27, 2014 @04:26PM (#7656686)
I would be much more inclined to read those papers if you gave a short reason as to why you think it got some things right, where others have failed.
Re:“Mostly functional” programming does not work by nextos on Sunday April 27, 2014 @07:38PM (#7657455)
Just have a look at the comments about the CTM book in c2, and the links to LtU:

http://c2.com/cgi/wiki?ConceptsTechniquesAndModelsOfComputer...

Re:“Mostly functional” programming does not work by weavejester on Sunday April 27, 2014 @12:36PM (#7655715)
I spent a couple of years using Haskell, but a few months after I started using Clojure I've switched over to using it pretty much exclusively.

I certainly didn't find Clojure to be a waste of time; to my mind it's a far more practically-minded language. It's philosophy of decoupling components is also interesting. For example, in Haskell, the static type system is coupled to the language; in Clojure, the static type system is an optional library.

Re:“Mostly functional” programming does not work by rdmckenzie on Sunday April 27, 2014 @02:20PM (#7656113)
responding to bitemyapp? brave...
Re:“Mostly functional” programming does not work by dorfsmay on Sunday April 27, 2014 @09:59AM (#7655065)
Have you completely switched to haskell now?
Re:“Mostly functional” programming does not work by coolsunglasses on Sunday April 27, 2014 @10:20AM (#7655150)
I've written an Elasticsearch client in Haskell just so I can port a project from Clojure.

I'm moving everything over that I can. Some legacy Clojure at work I'll have to leave alone for now, but going forward it's Haskell wherever I can.

Re:“Mostly functional” programming does not work by dorfsmay on Sunday April 27, 2014 @10:59AM (#7655310)
Have you found any drawback so far?

What is your take on the "you have to write clever, complicated code to make haskell work" (1). I've read that a lot of the code use for the language shootout is far from idiomatic haskell, but just plain clever, in order to get decent performance...

(1): http://jxyzabc.blogspot.ca/2009/03/haskell-vs-ocaml-or-ravin...

Re:“Mostly functional” programming does not work by coolsunglasses on Sunday April 27, 2014 @11:34AM (#7655459)
>"you have to write clever, complicated code to make haskell work"

Haha, no. I write pretty dumb Haskell myself. The author might've tripped into a library beyond their faculties. Also possible, they might've tried to make something "practical" before they really knew what they were doing. I made this mistake in the past myself.

The library I've been working on makes my boring Haskell obvious: https://github.com/bitemyapp/bloodhound/

I even tweeted a sample of my code making fun of how "stupid-simple" my Haskell is :)

I might refine the code later, but for now I'd rather KISS until I'm prepared to firm up the design.

You can get down a rabbit-hole with Haskell if you want, but the same is equally true of Clojure/Scala/C++/Ruby/Python/Perl.

Even then, the rabbit-hole at least has typed hand-rails.

Negatives?

Uhhh, missing libraries (which I am working to help remedy)

You develop a "nose" for libraries for which you aren't the audience. It's not a big or unavoidable negative, but there are definitely libraries on Hackage made to prove a point rather than for use in production. These libraries are easy to identify. Some of them are prefixed acme-*

The primary negative that matters is simply that Haskell is deeply unfamiliar to most working programmers, so while it's 100% worth it, the road to Haskell isn't as well-trodden or smooth as it would be going between Python <---> Ruby.

I'm working to remedy this as well. I've been teaching Haskell for the last ~6 months.

Re:“Mostly functional” programming does not work by bobfunk on Sunday April 27, 2014 @02:36PM (#7656174)
The source for Bloodhound really is clean and simple. I might actually just use the Types.hs file as a my goto reference for the ElasticSearch query format next time I need to write some of those!
Re:“Mostly functional” programming does not work by coolsunglasses on Sunday April 27, 2014 @08:54PM (#7657666)
You could even load it up in a REPL and generate the JSON to see what stuff looks like.
Re:“Mostly functional” programming does not work by nightski on Sunday April 27, 2014 @12:14PM (#7655626)
The general approach for functional programming is to make some thing right (provably correct), and then transform it into something performant. There are books (pearls of functional programming) that elaborate on this technique. The thing is, the series of transformations retains the correctness of the original implementation.

In reality this isn't necessary very often. It is important to understand persistent data structures, how they differ from imperative ones, and which to use in different situations. However with a good understanding of the fundamentals (just as in imperative code) you'll be writing idiomatic performant functional code fairly easily.

Re:“Mostly functional” programming does not work by metasim on Sunday April 27, 2014 @10:05AM (#7655096)
Is your argument that deep experience in Clojure is sufficient in determining FP/OO hybridization isn't a good idea or can't be done well? I didn't think that was in the sphere of Clojure's goals.
Re:“Mostly functional” programming does not work by coolsunglasses on Sunday April 27, 2014 @10:19AM (#7655145)
I've used a lot of languages, including Clojure and Scala. I'm saying any time spent learning Clojure when Haskell exists is a waste of time and a half-step.

Everybody who hasn't should be learning Haskell, regardless of background.

Teaching somebody Haskell is faster than explaining why the 1,001 dumb things mainstream languages do are dumb. I don't want to waste my time explaining why null values are dropdead stupid when I can just show them "Maybe".

We can talk about where we're headed after that.

Re:“Mostly functional” programming does not work by _halgari on Sunday April 27, 2014 @10:32AM (#7655193)
I find it funny to hear such grandiose claims about a language that can has yet to create a major killer project. That's why I can never bring myself to write Haskell. Show me the Storm, OTP, Datomic, Netflix, Whatsapp, etc. written in Haskell and perhaps I'll have a reason to change my mind. But until then all I see is C#, Scala, Erlang and Clojure shipping awesome products and the Haskell guys sitting in the corner saying "You're not doing it right!!!"
Re:“Mostly functional” programming does not work by coolsunglasses on Sunday April 27, 2014 @10:37AM (#7655218)
Haskell's community is a bit more thoughtful and less prone to self-promotion. That combined with the fact that you're not a Haskeller, you're not familiar with what they've built.

Another issue is that Haskell is somewhat weighted towards finance and they're a bunch that tends to be somewhat proprietary about their IP. Some exceptions (Ermine) exist.

Some notable projects that come to mind include git-annex and Parsec. Parsec has been preeminent parser-combinator library since forever.

Also: pugs, pandoc, gitit, Darcs, xmonad, Idris (same person that did whitespace, haha)

Recently? Cryptol. That's pretty major.

I'm building stuff in Haskell, right now. Specifically, the easiest to use Elasticsearch client in the world.

One was needed. Badly. The ES API's data structures were never specced out properly, just documented on an ad-hoc basis. The Haskell library I'm working on will, if nothing else, mean that there's a reference for how the JSON is structured.

Anyway, empower thyself, learn some Haskell: https://gist.github.com/bitemyapp/8739525

Edit:

Ah, I thought I knew that username from somewhere. The negative-nancy is Timothy Baldridge, an employee of Rich Hickey's company Cognitect. Cognitect is "the" Clojure company and represents the inner-clique.

Re:“Mostly functional” programming does not work by chetanahuja on Sunday April 27, 2014 @01:38PM (#7655967)
"That combined with the fact that you're not a Haskeller, you're not familiar with what they've built."

On the other hand, I don't have to be a php'r to know facebook was built in that language or a C++ programmer to know what google has done with it.

The negative-nancy is Timothy Baldridge, an employee of Rich Hickey's company Cognitect.

By personally attacking a critic of your claims, you're only making your case weaker.

Re:“Mostly functional” programming does not work by belovedeagle on Sunday April 27, 2014 @02:46PM (#7656224)
> personally attacking

Personal attack? What personal attack? Are you reading the same comment I am? He identified someone. If identification amounts to a personal attack, then that would seem to indicate severe problems with the image of the person being identified!

Re:“Mostly functional” programming does not work by chetanahuja on Sunday April 27, 2014 @04:49PM (#7656794)
"The negative-nancy is Timothy Baldridge, an employee of Rich Hickey's company Cognitect. Cognitect is "the" Clojure company and represents the inner-clique."

Apart from the juvenile "negative-nancy", there's also the clear implication of ascribing untoward motives based on the person's identity.

Re:“Mostly functional” programming does not work by lispm on Sunday April 27, 2014 @02:03PM (#7656057)
> The Haskell library I'm working on will, if nothing else, mean that there's a reference for how the JSON is structured.

Well, some projects document systems in MS WORD, you are using Haskell for documenting JSON structures. That's a step up.

[deleted]
Re:“Mostly functional” programming does not work by dang on Sunday April 27, 2014 @05:14PM (#7656918)
Please stop this—all of you.

The language flamewar is off-topic and inappropriate for HN. The personal attacks are beyond the pale.

Re:“Mostly functional” programming does not work by caughtexception on Sunday April 27, 2014 @12:49PM (#7655772)
> xmonad is stable.

> haskell + smart programming practices guarantee a crash

> free experience.

Yeah dwm, crashes all the time.

Why don't you try another approach to functional programming, like http://www.shenlanguage.org/ ?

If you think Haskell is The One True Way™, get a new pair of sun glasses.

Re:“Mostly functional” programming does not work by caughtexception on Sunday April 27, 2014 @10:34AM (#7655201)
> Learn Haskell properly and then see for yourself why "hybrids" are a waste of time.

/rant

Getting tired of puritans. You people are selling functional programming on the basis of "ideology", not merits.

Can the following be done in Haskell ?

* A Real Operating System.

* GPU programming.

* Embedded programming.

* If you can do all the above, can you replace Verilog ?

* Financial Programming.

  Ocaml is one of the "hybrids". Genetically impure,
  since it has "refs". But they have Jane Street.
* Games worth playing.

  assertion : If all the haskell programmers are put in
  a gulag, they can't come up with a half-decent
  game. 
  
  Nintendo Gameboy Games were written in assembly with 
  goto's. 

  Why don't you guys take a moment and pat yourselves on
  the back ? Hypocrisy-2.0 is probably in the hackage. 
  
Let's say you do all the above, GUI apps, distributed computing, <cool-buzz-word> ... without complains and ending up as a half-decent C++ or 1/10th lisp.

Haskell syntax is garbage.

(Common Lisp has a goto, gee what were they thinking ?)

Mathematicians pride themselves in their rich history of syntax.

Haskellers actually type "Arrow".

"I do consider assignment statements and pointer variables to be among computer science's most valuable treasures."

-- Only an Idiot could say that.

Re:“Mostly functional” programming does not work by dllthomas on Sunday April 27, 2014 @02:53PM (#7656244)
There are a number of toy operating systems written in Haskell. There are not very many "real operating systems" being written in any language, because it is a tremendous undertaking for uncertain value in a space that already has significant players with platform-effect lock in. I don't see why building a "real OS" in Haskell would be much harder than building a "real OS" in other languages, though.

I don't know anything about the state of GPU programming in Haskell, so I'm not going to speak to that.

Regarding embedded, GHC can target some quasi-embedded platforms these days, but it's also possible to write embedded programs in (pardon the overloading) an embedded DSL that can compile to C. Check out the Atom library.

I've heard about some people doing hardware synthesis involving (again) embedded DSLs in Haskell - I don't really know the state of it, but IIRC Conal Elliot gave a talk on some related stuff at one of the Bay Area Haskell meetups.

Jane Street is doing a lot of O'Caml stuff, and that's awesome, but there's definitely a lot of Haskell in finance these days as well (I've seen several job postings, and heard some chatter generally). I don't know which is better represented, or how it compares to other stuff - most big finance places don't talk about what they're doing inside.

Oh, and Haskellers actually type "Arrow" when they're working with a particular generalization of functions. When they're actually working with functions, they type ->.

Re:“Mostly functional” programming does not work by caughtexception on Monday April 28, 2014 @02:17PM (#7661851)
hypocrisy: the practice of claiming to have moral standards or beliefs to which one's own behavior does not conform; pretense.

"GHC can target some quasi-embedded platforms these days, but it's also possible to write embedded programs in (pardon the overloading) an embedded DSL that can compile to C."

Haskell can't do any useful work without relying on C. Instead of having pride in what C can do, you have invented the following adjectives "hybrid", "mathematical language", "insecure", "impure", "pure".

Either,

1) Stop with the adjectives and get Real.

2) Prove that Haskell can replace C, the "impurity".

The same holds true for mathematical heritage. I would ask mathematicians to use Mathematica, not Haskell.

(I don't consider OCaml to be a part of this debate because OCaml is hybrid and Real, like C++)

Re:“Mostly functional” programming does not work by dllthomas on Monday April 28, 2014 @11:49PM (#7664830)
You asked some questions, I answered them in an attempt to be helpful. Any conclusions you draw about my personal beliefs are spurious and roughly as well founded as your conclusions generally. For what it's worth, I write a bunch of C and I like C very much. I also like Haskell and have to say you really don't know what you're talking about here. I'm not interested in dealing further with these kinds of ramblings, at this point.
Re:“Mostly functional” programming does not work by caughtexception on Wednesday April 30, 2014 @03:06AM (#7671973)
> my personal beliefs

Your and the haskell community's puritan behavior.

> you really don't know what you're talking about here.

Can't Parsec English ? I define the word hypocrisy, from a dictionary no less.

Re:“Mostly functional” programming does not work by dllthomas on Wednesday April 30, 2014 @08:03AM (#7672720)
This is nothing but trolling. I wasn't disputing your definition; but you weren't including it as merely an informative point on a random English word. By the pragmatics of English conversation, it was clearly meant as an accusation in this context. Your retreat to defense of the definition, as opposed to any notion of the applicability of the definition or of anything else you've said, is disingenuous. In any event, at this point I am done responding in this thread, whatever else is posted.
Re:“Mostly functional” programming does not work by PeterisP on Sunday April 27, 2014 @04:59PM (#7656847)
For GPU programming - Haskell is a quite good option for running [parts of] your heavy computations on the GPU instead of the CPU, and the language features directly help with that.

And Verilog is quite well entrenched, but if/when it's going to be replaced by something else, currently it seems that it will most likely be a Haskell derivative, something similar to Bluespec perhaps.

But can you clarify your point ? The cause of the rant seems to be for the "hybrids are a waste of time" line, however, most of the examples you provide are things that are currently done by, say, C/C++ but not by the hybrid languages.

Are you claiming that the hybrid languages are (or will be) much more widely used for developing 'A Real Operating System', embedded programming or mass-market games?