Live data from Hacker News

From Ruby to Haskell, Part 1: Testing

bendyworks.com

1–10 of 21 posts

Re: From Ruby to Haskell, Part 1: Testing

#3
Just talking aloud, here. Sorta frustrated.

I recently dove into Scala for fun and I enjoy its terse syntax (often more terse than Ruby's!) and principles. I was really excited about it at first.

But the excitement went away pretty quickly last weekend when I actually tried building things with it.

Setting up a Sinatra app in Ruby is a matter of 'gem install sinatra', a 'require "sinatra"', and you're ready to roll.

Meanwhile setting up a Scalatra app in Scala was a far more involved process, every tutorial getting me to use a tool called 'giter8' just to copy down app boilerplate from github. I also ran into general difficulties just setting up IntelliJ/Eclipse, falling back to Vim which makes compilation errors feel like runtime errors since I had to go back to the terminal to see that my program didn't even compile.

I pine for a world where I can just `scale install scalatra` (or pop it into my Scalefile), `$ vim app.scala`, and begin coding.

I still plan on writing some "Scala for Rubyists"-type blog posts, but it's a shame I couldn't figure out and enjoy the actual workflow. I'd have more patience coming from an ecosystem that didn't make things as easy as Ruby's does, but I've realized that tools/workflow/environment are showstoppers no matter how much you enjoy a language.

Re: From Ruby to Haskell, Part 1: Testing

#5
post #3

Just talking aloud, here. Sorta frustrated. I recently dove into Scala for fun and I enjoy its terse syntax (often more terse than Ruby's!) and principles. I was really excited about it at first. But the excitement went away pretty quickly last weekend when I actually tried building things with it. Setting up a Sinatra app in Ruby is a matter of 'gem install sinatra', a 'require "sinatra"', and you're ready to roll.…

You are not alone in this. Scala has had ecosystem problems for a long time and because of the community status, that's unlikely to get much better anytime soon.

One of the reasons I've been preferring haskell and clojure for my work is because scala's toolchain abused me so badly.

Re: From Ruby to Haskell, Part 1: Testing

#7
post #3

Just talking aloud, here. Sorta frustrated. I recently dove into Scala for fun and I enjoy its terse syntax (often more terse than Ruby's!) and principles. I was really excited about it at first. But the excitement went away pretty quickly last weekend when I actually tried building things with it. Setting up a Sinatra app in Ruby is a matter of 'gem install sinatra', a 'require "sinatra"', and you're ready to roll.…

libraryDependencies ++= Seq( "org.scalatra" %% "scalatra" % "2.0.4", "org.scalatra" %% "scalatra-scalate" % "2.0.4", "org.scalatra" %% "scalatra-specs2" % "2.0.4" % "test", "ch.qos.logback" % "logback-classic" % "1.0.0" % "runtime", "org.eclipse.jetty" % "jetty-webapp" % "7.6.0.v20120127" % "container", "javax.servlet" % "servlet-api" % "2.5" % "provided" )

in your build.sbt too difficult? Admittedly a bit longer than bundling/gem installing, but not too difficult?

(Although I haven't had to use scalatra personally in a project so there might be hackery I'm missing)

Re: From Ruby to Haskell, Part 1: Testing

#8
post #7
post #3

Just talking aloud, here. Sorta frustrated. I recently dove into Scala for fun and I enjoy its terse syntax (often more terse than Ruby's!) and principles. I was really excited about it at first. But the excitement went away pretty quickly last weekend when I actually tried building things with it. Setting up a Sinatra app in Ruby is a matter of 'gem install sinatra', a 'require "sinatra"', and you're ready to roll.…

libraryDependencies ++= Seq( "org.scalatra" %% "scalatra" % "2.0.4", "org.scalatra" %% "scalatra-scalate" % "2.0.4", "org.scalatra" %% "scalatra-specs2" % "2.0.4" % "test", "ch.qos.logback" % "logback-classic" % "1.0.0" % "runtime", "org.eclipse.jetty" % "jetty-webapp" % "7.6.0.v20120127" % "container", "javax.servlet" % "servlet-api" % "2.5" % "provided" ) in your build.sbt too difficult? Admittedly a bit longer tha…

You just copy and pasted the output of giter8's black magic* and asked me if I think the resulting magical incantation is too difficult? Look at Scalatra's installation steps: http://www.scalatra.org/getting-started/installation.html. They don't even give you the sbt dependency. They just direct you to the tool that generates it for you. -- A tool that's only used for a couple other dozen projects: https://github.com/n8han/giter8/wiki/giter8-templates.

Even if you typed that in by hand, you sure took a big detour on your journey of simply declaring "I just want the latest version of Scalatra that works so I can begin coding" by having to go specify Jetty version 7.6.0.v2012012759 and friends.

I don't find it "too difficult". Rather, it's just confusing, nontrivial, and it obstructed my progress with Scala.

*I know g8 just copies down a project from Github like https://github.com/scalatra/scalatra-sbt.g8/blob/master/src/..., but having tools that generate input for other build tools is along my point.

Re: From Ruby to Haskell, Part 1: Testing

#9
Heh, never seen someone so defensive about using Haskell before.

I'm not sure that the "here's now to do this Ruby thing in Haskell" method of learning Haskell is a good way to go about it. It would work well to teach Python or JS but not a Lisp or Haskell or Prolog. They differ at a lower level and require different mental models to even understand them, nevermind thinking in them.

I don't see it helping if you are trying to cram monads, laziness, side effect free programming, inferred types and new syntax into the mental model of code execution you use for Ruby.

Has anyone learned that way and found it useful? Do you learn a few things in a familiar context while cargo-culting the rest and then fill in the gaps later? Does it just click all of a sudden?

My biggest struggle was learning to think in Haskell and this type of mixed metaphor teaching material would just make things worse. That might not apply to everyone, but if it applies to you then you aren't alone. Try learning the execution model with little toy programs first, then move on to the kind of software you are used to writing once you know how to look at Haskell code and reason about what it does.

Re: From Ruby to Haskell, Part 1: Testing

#10

   move from perhaps the most dynamic language to what is perhaps the most static?
I don't think this continuum has any meaning, but s/he should look at GHC Typeables, deferred type checking and the type holes work in the "most static"

http://www.reddit.com/r/haskell/comments/10u7xr/ghc_head_now...

https://news.ycombinator.com/item?id=4380900

http://hackage.haskell.org/trac/ghc/wiki/DeferErrorsToRuntim...

Post reply on HN