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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Haskell web framework IHP aims to make web development type-safe and easy

88 点作者 _query超过 4 年前

10 条评论

q3k超过 4 年前
I&#x27;ve tried this out a few days ago. I have some basic theoretical Haskell knowledge, but not much practical experience. However I do have some significant Nix experience.<p>Ended up not even going through the beginner tutorial, as the installer&#x2F;scaffold process required me to do things that I didn&#x27;t like:<p>- forced scaffolding of projects with some quite blackboxy generated shell scripts inside<p>- use of nix, yet requiring me to install &#x27;make&#x27; and &#x27;direnv&#x27; system-wide (why? just let me use a shell.nix)<p>- required me to use cachix.org as a system-wide nix substituter, which I don&#x27;t want to do for security reasons (just allow me to build everything myself)<p>All in all this looked promising, but ended up being too magical for my taste. I&#x27;d like to be able to start using IHP &#x27;from scratch&#x27; instead - with my own Cabal&#x2F;Nix&#x2F;Bazel build machinery. This is a critical requirement for libraries&#x2F;frameworks that I use.<p>Your mileage may vary though - if you&#x27;re okay with RoR-like scaffolding and blackboxness, then you might feel at home here, and at least you get a nicely typed language in return.
评论 #24828441 未加载
评论 #24828318 未加载
评论 #24829796 未加载
embwbam超过 4 年前
This looks well done, but having used Haskell professionally on multiple web projects, I have to take issue with some of the design choices.<p>Templating? Haskell provides such a wonderfully clean way to generate HTML via combinators and do notation. You don&#x27;t need a quasi quoter to get a DSL. See Lucid. All templating does is remove control features (like forM, for example). [1]<p>They&#x27;ve reinvented common operators. For example, (|&gt;), which is great, I&#x27;ve used it in Elm, but the Haskell version of this is (&amp;) from Data.Function.<p>These are just a few examples. They&#x27;re ignoring Haskell conventions to make it more familiar to people coming from other backgrounds, even when the community conventions are strictly better or equal. Rails was a nightmare for me, it was impossible to tell what was a language feature and what came from the framework. I suspect this will equivalently speed up initial development while slowing understanding.<p>[1] <a href="https:&#x2F;&#x2F;mmhaskell.com&#x2F;blog&#x2F;2020&#x2F;3&#x2F;16&#x2F;lucid-another-html-option" rel="nofollow">https:&#x2F;&#x2F;mmhaskell.com&#x2F;blog&#x2F;2020&#x2F;3&#x2F;16&#x2F;lucid-another-html-opti...</a>
评论 #24828882 未加载
kodefant超过 4 年前
I have been learning Haskell through IHP. It&#x27;s the best and actually simplest web framework I have ever tried.<p>The developer experience is the best I ever had for a MVC-style framework. And I got to learn Haskell without banging my head too much against the wall. Really enjoyed it :)<p>I really needed something like IHP to get started with Haskell. It&#x27;s fun and easy and the documentation is very easy to follow.<p>I see some argue that they wish to make more custom choices regarding the setup. That is precisely what I don&#x27;t want and that&#x27;s why IHP is a great fit for me.<p>In terms of simplicity I think the choice of supporting only Nix and Postgres actually are strengths at this point. That lets them streamline the development of the framework without supporting the minor preferences of every individual. And these choices should work really well for most web developers.<p>Some may disagree on this, and maybe IHP is not for them, but I don&#x27;t think it shouldn&#x27;t discourage those who considers trying it out and form their own opinion.<p>I was prepared for great hardships learning Haskell as most of the resources are very academic and I&#x27;m mainly just a simple application builder. IHP was just what I needed to fill that gap, and it made it really fun :)<p>I am tweeting about the whole thing, coding Haskell for 100 days: <a href="https:&#x2F;&#x2F;twitter.com&#x2F;larsparsfromage" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;larsparsfromage</a>
montmorency88超过 4 年前
IHP is the best web framework experience I have had. I think a lot of aspiring haskeller&#x27;s will have worked their way through a text like Learn You a Haskell For Great Good or similar and then be looking to fool around with an actual project.<p>IHP uses nix to cut out all the work of setting up ghc&#x2F;stack&#x2F;cabal which can be quite tricky for a beginner, it has just added haskell language server integration, it starts your postgres servers, it spares you from having to remember your SQL syntax, and means you can start writing haskell code instantly while getting immediate feedback on your hacking from GHCi and visually through the live reloading of the web app in your browser.<p>I&#x27;ve found the [hsx||] quasiquotes quite fun to work with and type safety has sped up development by preventing bugs that can easily crop up when you&#x27;re linking forms to databases.<p>I like the design choices in IHP, and for me, at the moment, I like the focus on server side web app development, which encourages you to be more sparing&#x2F;judicious in the use of javascript.<p>With IHP being opinionated about the models&#x2F;views and routing it means I can focus on integrating some of the other really cool haskell libraries that exist into web apps. (I&#x27;m also trying to keep a log of my experiences here on an <a href="https:&#x2F;&#x2F;ihpcafe.ihpapp.com" rel="nofollow">https:&#x2F;&#x2F;ihpcafe.ihpapp.com</a> if you want to read along with someone figuring out function type signatures ;) )
all_factz超过 4 年前
This is the first Haskell web development framework (granted, I haven’t looked at very many) that would actually make me interested in trying web dev in Haskell. Coming from a Django&#x2F;PHP background, it seems it provides a lot of desirable functionality and type-safety out of the box while also being relatively comprehensible for a Haskell newbie.
评论 #24828421 未加载
评论 #24828788 未加载
Kaze404超过 4 年前
I tried this a couple weeks ago and while the process was rather smooth (as a newcomer to Haskell), the process to add authentication to the application was not explained at all in the docs -- they just have you copy and paste a bunch of code. Hopefully that can be improved in the future :)
评论 #24828321 未加载
ljm超过 4 年前
I gave this a shot, to see if it&#x27;d be better than writing my API with Servant and then building a client separately. It looks really cool and there&#x27;s been a lot of work put into it, so I had to see for myself.<p>I kind of wish it didn&#x27;t depend on Nix and Cachix and stuff like that, compared to deploying as a Stack template. I can see how it simplifies setup of a lot of the environment but considering the various issues I had trying to run it through WSL2, it left me at a point where I couldn&#x27;t really understand what was going wrong.<p>I&#x27;m back to messing around with Servant, but that&#x27;s also because I&#x27;m not the target user for rapid web dev in this case. I want to learn Haskell my own way.
claudiulodro超过 4 年前
I work with commodity LAMP-style hosting mostly, so I&#x27;m not familiar with this sort of framework. How involved is setting up and running a Haskell web server? Is it a fully bespoke thing that needs to be figured out, or is it just like an image you install? Is this stuff generally hosted on standard clouds (e.g. AWS)? IMO the server setup seems to be the biggest issue with these sorts of boutique web frameworks, but I&#x27;d love to learn more if I&#x27;m incorrect.
评论 #24828578 未加载
AlexITC超过 4 年前
While IHP looks nice, it will certainly take a while to get into a similar shape to scalajs, in any case, I&#x27;m happy to see more work on the typed side for web development.<p>For anyone interested, Web Development is already Type-Safe and Easy by leveraging scala-js.org, being an amazing project.<p>It was the first project in the area to get amazing IDE support for free, where even TypeScript took a while to catch-up, and I still personally believe the auto-completion &#x2F;refactor&#x2F;navigation support is better in scalajs.<p>For people not familiar, take a look to this js to sjs comparison: <a href="https:&#x2F;&#x2F;www.scala-js.org&#x2F;doc&#x2F;sjs-for-js&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.scala-js.org&#x2F;doc&#x2F;sjs-for-js&#x2F;</a><p>My preferred tech stack is now <a href="https:&#x2F;&#x2F;scalablytyped.org" rel="nofollow">https:&#x2F;&#x2F;scalablytyped.org</a> (like definitelytyped for Scala), <a href="https:&#x2F;&#x2F;slinky.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;slinky.dev&#x2F;</a> (a small react wrapper), and <a href="https:&#x2F;&#x2F;material-ui.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;material-ui.com&#x2F;</a>, which makes me work on the frontend at an incredible speed, while being confident on a low-bug rate.
nsonha超过 4 年前
Jsx is a plague. What&#x27;s wrong with simply nesting function calls like in elm and fsharp? Someone goes this far to learn a rather eccentric language you think they care about superficial familarities?