TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

From Ruby to Haskell, Part 1: Testing

66 点作者 twopoint718超过 12 年前

4 条评论

danneu超过 12 年前
Just talking aloud, here. Sorta frustrated.<p>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.<p>But the excitement went away pretty quickly last weekend when I actually tried building things with it.<p>Setting up a Sinatra app in Ruby is a matter of 'gem install sinatra', a 'require "sinatra"', and you're ready to roll.<p>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.<p>I pine for a world where I can just `scale install scalatra` (or pop it into my Scalefile), `$ vim app.scala`, and begin coding.<p>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.
评论 #4884766 未加载
评论 #4886151 未加载
评论 #4885604 未加载
评论 #4884868 未加载
评论 #4886152 未加载
freshhawk超过 12 年前
Heh, never seen someone so defensive about using Haskell before.<p>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.<p>I don't see it helping if you are trying to cram monads, laziness, side effect free programming, inferred types <i>and</i> new syntax into the mental model of code execution you use for Ruby.<p>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?<p>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.
评论 #4885725 未加载
评论 #4885763 未加载
gtani超过 12 年前
<p><pre><code> move from perhaps the most dynamic language to what is perhaps the most static? </code></pre> 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"<p><a href="http://www.reddit.com/r/haskell/comments/10u7xr/ghc_head_now_features_agdalike_holes/" rel="nofollow">http://www.reddit.com/r/haskell/comments/10u7xr/ghc_head_now...</a><p><a href="https://news.ycombinator.com/item?id=4380900" rel="nofollow">https://news.ycombinator.com/item?id=4380900</a><p><a href="http://hackage.haskell.org/trac/ghc/wiki/DeferErrorsToRuntime" rel="nofollow">http://hackage.haskell.org/trac/ghc/wiki/DeferErrorsToRuntim...</a>
评论 #4885679 未加载
coderhs超过 12 年前
Why? whats the need or advantage of going to Huskel from Ruby??
评论 #4884623 未加载
评论 #4884780 未加载
评论 #4910470 未加载
评论 #4886044 未加载