Re:Functional Programming in Haskell by Examples
by M00n_Sl47r on Monday April 27, 2015 @03:43PM
(#9448646)
The grammar in this is a bit off. I'll probably submit a pull request with some edits, if that's something people do? I'm not sure about the etiquette surrounding grammar mistakes in a github repo.
Re:Functional Programming in Haskell by Examples
by jonreem on Monday April 27, 2015 @04:09PM
(#9448779)
Personally I am always thrilled to get grammar/typo fix pull requests to my projects. It means someone cared enough about the project to go through the effort of making a PR just to alleviate a small aesthetic problem!
Re:Functional Programming in Haskell by Examples
by bontoJR on Monday April 27, 2015 @05:05PM
(#9449071)
Definitely a good habit, I think more than the 50% of Github users are not English as mother tongues, so it's good to polish documentations, or like in this case, long texts. I always accept pull-requests for grammar improvements.
Re:Functional Programming in Haskell by Examples
by christianbryant on Monday April 27, 2015 @03:06PM
(#9448464)
I'm curious how you feel Haskell has helped you. Do you actually use Haskell for a great percentage of your deliverable code or do you simply use it for ideas, experimentation and so forth?
I love it. I mean I could have done the same thing in node. But there's something about the workflow in Haskell. I need to add a new feature I didn't think of. But I don't have to refactor as aggressively because all my code is made up of little functions. I start hacking, my editor has a list of errors I still need to clean up. I clean them up, and it usually works the first try.
Or this morning I wanted to add a connection pool to my rethinkdb driver code. The resource-pool package gives you an awesome way to do it for anything. Without knowing about rethinkdb at all.
Also this morning I wanted to do some IO in parallel. I found several nice concurrency packages and threw one in without any refactoring.
It has its difficulties (deployment?) but I'm really enjoying it.
Re:Functional Programming in Haskell by Examples
by qubitcoder on Monday April 27, 2015 @04:50PM
(#9448988)
Similar story here. I find I'm able to accomplish tasks which would otherwise be beyond my skill and intelligence. For example, even though C was the first language I learned, I can't imagine writing a parser in C after discovering the simplicity & readability of monadic parsing in Haskell. [1] Just compare that page with the parser/lexer for the Jq tool on the HN homepage (written in C).
A few months ago, I needed to retrieve JSON data from a list containing dozens of URLs. Fortunately, the "async" package handles this beautifully: [2]
Once you learn the basic concepts of Haskell and get over the hump, you’re able do things with ease that would otherwise take many years to master in C++ [3]. Even the most advanced features of the language follow the same underlying principles & syntax.
My advice to those wanting to learn Haskell is simply not to give up. Keep coming back to it. Practice. Read other’s code. Over time, things will begin to click. And once they do, you’ll wonder why you struggled so much in the first place.
Re:Functional Programming in Haskell by Examples
by embwbam on Monday April 27, 2015 @04:24PM
(#9448862)
Just compared to dynamic languages. Cross compiling and such. I went with docker (see the repo) and it works. Deploys via docker push are a little slower than I'd like but nothing I can't improve later.
Re:Functional Programming in Haskell by Examples
by creichert on Monday April 27, 2015 @04:52PM
(#9449003)
I see, it really depends on your goal. The Dockerfile in the repo looks like it's built primarily for Haskell development.
When I'm working with production environments, I build the Haskell executable locally and add that (statically linked) program to the Dockerfile. That should tremendously speed things up. The caveat is that your local and production architecture are the same. I find deploying the static executable much quicker and more simple. You aren't doing it wrong, just thought I would my own preferences.
Some environments like Elastic Beanstalk have timeouts that will kill the build if it doesn't build quickly enough (a problem on smaller VMs). Another issue is potential RAM needed by GHC.
Keep in mind that Haskell executables statically link Haskell libraries and dynamically link system libs (by default). You can find your system library dependencies by running:
Re:Functional Programming in Haskell by Examples
by embwbam on Monday April 27, 2015 @04:59PM
(#9449031)
That sounds way nicer than my 30 minute deploy process. I develop on a mac and deploy to ubuntu. How would you recommend I build? Vagrant? (I almost finished getting the vagrant stuff working).
Re:Functional Programming in Haskell by Examples
by Ericson2314 on Monday April 27, 2015 @07:46PM
(#9449812)
I highly recommend https://github.com/NixOS/nixops, which is good for deployment in general, but especially good for Haskell since the Haskell infrastructure was rewritten this year.
Re:Functional Programming in Haskell by Examples
by codygman on Monday April 27, 2015 @10:17PM
(#9450273)
I found myself using cabbage[0] so I could have exact version dependencies. Nix was awesome when mostly using latest versions of a package, but for much of my code I needed specific versions and cabbage allowed me to have them.
Re:Functional Programming in Haskell by Examples
by Ericson2314 on Sunday May 10, 2015 @04:51AM
(#9519348)
For the sake of a single manager for my whole system I'll stick with nix. But yes, it would be nice if it knew more about versions. In a future where upstream projects can maintain their own nix packages, I think this will be unavoidable.
Re:Functional Programming in Haskell by Examples
by benmos on Tuesday April 28, 2015 @03:35AM
(#9450899)
Nix (and NixOS, NixOps etc) is totally, totally awesome (only downside is that it's not a statically typed language itself). Just be warned that it does have a non-trivial learning curve of its own though.
You can try to skip to the wiki page, but in the likely case something doesn't go quite right, it will be hard to debug without a broader knowledge of Nix.
I'll admit Nix's has quite the learning curve, and I was more tempted to sneak around its uncompromising rigidity than when learning Haskell. But the bitter pill is worth it.
Re:Functional Programming in Haskell by Examples
by the_af on Monday April 27, 2015 @04:54PM
(#9449011)
I use it for my own experiments and never -- sadly -- for work, where my boss thinks Scala is just syntax sugar over Java, which is in turn merely syntax sugar over C. I don't think he has ever heard of Haskell, and I don't have the energy to have that conversation with him, when he is already so dismissive of Scala.
But I still have ghci installed at work, and I find it surprisingly useful to use Haskell to prototype (pure) functions for Scala! This is something I truly didn't see coming, but now I often find myself starting ghci when I want to see if some combination of folds or maps works the way I think it should, and for some reason it feels way more convenient than trying it in Scala.
Re:Functional Programming in Haskell by Examples
by sls on Tuesday April 28, 2015 @01:40AM
(#9450665)
C is just portable assembler, ask him why he's got people wasting company time and cpu cycles on such a thing. I'm sure you're targeting x86, time to put on your big boy pants.
The reactions are overwhelmingly positive. Just make sure to leave a nice comment.
Your monad section looks solid, although now I undestand them I can no longer tell if a tutorial is good or not :-)
I love it. I mean I could have done the same thing in node. But there's something about the workflow in Haskell. I need to add a new feature I didn't think of. But I don't have to refactor as aggressively because all my code is made up of little functions. I start hacking, my editor has a list of errors I still need to clean up. I clean them up, and it usually works the first try.
Or this morning I wanted to add a connection pool to my rethinkdb driver code. The resource-pool package gives you an awesome way to do it for anything. Without knowing about rethinkdb at all.
Also this morning I wanted to do some IO in parallel. I found several nice concurrency packages and threw one in without any refactoring.
It has its difficulties (deployment?) but I'm really enjoying it.
A few months ago, I needed to retrieve JSON data from a list containing dozens of URLs. Fortunately, the "async" package handles this beautifully: [2]
Once you learn the basic concepts of Haskell and get over the hump, you’re able do things with ease that would otherwise take many years to master in C++ [3]. Even the most advanced features of the language follow the same underlying principles & syntax.My advice to those wanting to learn Haskell is simply not to give up. Keep coming back to it. Practice. Read other’s code. Over time, things will begin to click. And once they do, you’ll wonder why you struggled so much in the first place.
[1] https://www.fpcomplete.com/school/starting-with-haskell/libr...
[2] https://hackage.haskell.org/package/async-2.0.2/docs/Control...
[3] http://chimera.labs.oreilly.com/books/1230000000929/index.ht...
Anything specific? What kind of environments are you deploying in?
When I'm working with production environments, I build the Haskell executable locally and add that (statically linked) program to the Dockerfile. That should tremendously speed things up. The caveat is that your local and production architecture are the same. I find deploying the static executable much quicker and more simple. You aren't doing it wrong, just thought I would my own preferences.
Some environments like Elastic Beanstalk have timeouts that will kill the build if it doesn't build quickly enough (a problem on smaller VMs). Another issue is potential RAM needed by GHC.
Keep in mind that Haskell executables statically link Haskell libraries and dynamically link system libs (by default). You can find your system library dependencies by running:
0: https://github.com/acowley/cabbage
|nix keywords| << |docker keywords| << |nix idioms|
I really recommend you first read about nix with http://lethalman.blogspot.com/feeds/posts/default/-/nixpills . Once you've done that, the simple instructions at http://wiki.ocharles.org.uk/Nix should get you going.
You can try to skip to the wiki page, but in the likely case something doesn't go quite right, it will be hard to debug without a broader knowledge of Nix.
I'll admit Nix's has quite the learning curve, and I was more tempted to sneak around its uncompromising rigidity than when learning Haskell. But the bitter pill is worth it.
But I still have ghci installed at work, and I find it surprisingly useful to use Haskell to prototype (pure) functions for Scala! This is something I truly didn't see coming, but now I often find myself starting ghci when I want to see if some combination of folds or maps works the way I think it should, and for some reason it feels way more convenient than trying it in Scala.