TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Rails on OCaml

55 pointsby pvsukale3about 6 years ago

7 comments

FearNotDanielabout 6 years ago
So, I&#x27;m just beginning to dip my toe into functional programming and trying to figure out if and when this approach has real-world benefits. But I&#x27;m constantly surprised by the emphasis that articles like this put onto the advantage of having types as one of the reasons for making the paradigm shift to functional. If someone from the Rails world asked me how to get the benefits of a type system in server-side web app code, I would say why not just move over to C#&#x2F;ASP.NET or any other procedural language that has strong typing built in. That alone is not enough to justify the learning curve, not to mention the business risk of adopting an &#x27;experimental&#x27; technology (decades old, yes, but still relatively untested for ordinary enterprisey web applications) and thus have a much smaller talent pool when it comes to hiring.<p>I get that people coming from Ruby&#x2F;JS&#x2F;Python world will go &quot;woo, types!&quot; but you don&#x27;t need to go functional to get that; I wish more of these articles would explain why the nuances of functional type systems, and other benefits of the functional approach, lead to concrete advantages when it comes to building real systems that do useful work.
评论 #19524569 未加载
scotty79about 6 years ago
&gt; ... Java’s anemic type system (which forced complex class hierarchies where, in dynamic languages ...<p>It just occured to me that relationship between Java and more expressive languages that do more, parallels relationship between microservices architecture and monoliths.<p>Because in Java it&#x27;s hard to make smart classes that do everything you need, you need to create whole ecosystem of dumb classes that only through their interaction are capable of doing what you need. But the language has no tools to deal with interactions between classes. For monitoring them and reshaping them just as there&#x27;s no tooling in microservices architecture to deal with complexities of inter-service interactions.<p>So in theory you have nice isolated units that should be easy to change and swap. But you just pushed the complexities of your problem to in-between of your units where they are no longer well visible and very hard to manage and evolve.
mooredsabout 6 years ago
I know that this isn&#x27;t quite rails on ocaml (or, to be pedantic, ocaml on rails), but spring boot brings type safety and a lot of the joy of rails together.
networkedabout 6 years ago
The metaphor comparing Ruby to poetry and OCaml to prose feels backwards to me. It is typed languages that have you choose some kind of rhythm, commit to it, and follow it. Once you&#x27;ve committed to it, breaking the rhythm productively is difficult. It is done at your own peril, it can send the whole edifice climbing down, and it often leaves the reader dissatisfied. Untyped languages are comparatively free-form (free verse?).<p>I would like to see a typed-FP Phoenix for a typed-FP equivalent to Elixir: a language that builds on an existing platform with a great focus on the UX and the tooling. Perhaps Reason could become that language, or something derived from Haskell. (Although Haskell&#x27;s Elixir would be in a difficult situation. It would need to compile faster than Haskell to have a really good UX.) Then again, maybe that language would build on top of a less obvious choice for FP aficionados, like Go.<p>Right now the Rails-like web framework with a focus on type safety I find the most promising exists in a multiparadigm language and isn&#x27;t devoted to FP. It is Lucky for Crystal.
评论 #19457598 未加载
aboutrubyabout 6 years ago
On a related note, Stripe may open source their ruby type checker at some point, sorbet: <a href="https:&#x2F;&#x2F;sorbet.run" rel="nofollow">https:&#x2F;&#x2F;sorbet.run</a><p>If you are interested you can email sorbet@stripe.com (it&#x27;s been almost a year with no releases though).
ObscureScienceabout 6 years ago
I think Ur&#x2F;Web is interesting to mention related to this.<p><a href="http:&#x2F;&#x2F;www.impredicative.com&#x2F;ur&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.impredicative.com&#x2F;ur&#x2F;</a>
arambhashuraabout 6 years ago
What about Ocsigen and Eliom?<p><a href="http:&#x2F;&#x2F;ocsigen.org&#x2F;home&#x2F;intro.html" rel="nofollow">http:&#x2F;&#x2F;ocsigen.org&#x2F;home&#x2F;intro.html</a>