top | item 25184294

IHP – A Haskell web framework

148 points| laobiz | 5 years ago |github.com

39 comments

order
[+] dmix|5 years ago|reply
Two rather insignificant observations:

- the video scaffold redirected to localhost:8000/Posts why in the world are the controller paths capitalized? So rare to see that but somehow I'm less surprised in haskell

- the name sounds a lot like i-Hop and I can't get it out of my head now and it will forever be that. First impressions have a way of sticking around

Otherwise I like the opinionated direction they chose. Especially being a dev-shop we're using it for ourselves so we don't really care about taking a community-census type approach to things. They only care about what works for creating real things.

Having gone down the Haskell road, letting someone make the hundreds of early choices for you seems to be the best way to go for early adoption. Typically the under-layers remain abstract enough for the true hackers, which also seems to be the case here (from reading about the blaze-html integration).

Which I always believe is a solid foundation for any useful framework. The demanded customizations can always be supported later. Modularization tends to come later as a project matures, but the early days it's best to take a singular path that works for the founding team until maturity is reached and wait/see if it does indeed become popular first to justify the more modular/customizable approach.

I haven't tried it myself though but I seem to be close to the target market being both a past Rails dev and a Haskell fan. So I'll keep it on the back burner for until I have time.

[+] _query|5 years ago|reply
Thanks for your thoughts!

> why in the world are the controller paths capitalized

The idea behind that is that it makes mapping from url to action easier when trying to understand how things work.

E.g. `/Posts` maps to `PostsAction`. `/NewUser` maps to `NewUserAction`.

I think longterm urls don't matter that much anymore as many browsers just hide them completly (think Safari, many mobile browsers, etc.), so we optimize them for development purposes :)

(Disclaimer: Founder of digitally induced, the company behind IHP)

[+] lambda_obrien|5 years ago|reply
I love writing Haskell code, but the community desperately needs to agree on one method of install and project setup-- cabal, stack, nix, whatever-- and then make it WAY easier for new users to start projects.

I'm not at all saying simplify the language for the LCD, but I have to manage all three of those tools and more and their usability is horrible. The configs are all over the place, there's 2 or 3 per project repo, another several global configs, the command line tools have a thousand flags and switches, the compiler language extensions are insane (i have like 30 turned on by default, and those are just the safe ones), i could continue...

This project, at least, tries to help the new user get into it quickly, I appreciate that because it helps me get my friends to try Haskell for a nontrivial use right away, then they want to invest the time to learn the rest of the Haskell toolchain bullshit.

[+] egonschiele|5 years ago|reply
FWIW stack uses cabal under the hood but is far easier to use. I would not use cabal these days, stack solves a lot of the dependency issues cabal had.
[+] johnbonachon|5 years ago|reply
I do know there's not a single/unique way of installing dependencies, etc. But the IHP docs are enough clear to set up a project and install everything in just a moment. Maybe the Haskell community doesn't have a clear choice, but the people of DI have made that very simple.
[+] cies|5 years ago|reply
I'd say this competition has been the reason for some amazing innovation. Both Nix and Stack are pretty next level compared what most other languages have going. And since there is no big corp (like Google for Golang) to order what to use, we will have competing standards for a long time.
[+] whateveracct|5 years ago|reply
You can just use ghcup and cabal. The cutover you're nix-style cabal builds has happened and they are excellent.

You can even just use ghcup and cabal but work against a Stackage LTS snapshot for added ease.

If you end up using Nix in the future, barely anything will change for you if you start with bare cabal. It's additive, not a replacement.

Same goes for if you use stack as an enhancement, although a big appeal of stack is its own CLI.

[+] icrbow|5 years ago|reply
I would like to have stack backported into cabal, but Nix and others, that just entire code galaxies.

At least that isn't cmake et al.

[+] masijo|5 years ago|reply
IHP has a lot of potential and it's getting better by the day. The way I see it, its weakest point is the documentation: things like changing the default UI framework (bootstrap), integrating react or another frontend framework, giving more complex examples (with foreign keys i.e.), changing the URL style, exposing JSON endpoints, and so on. I also didn't like the automatic generation of controllers, views, etc that it offers, I found it quite more confusing than just manually writing them out. Maybe this is because I come from Django instead of Rails, but I still wanted to point that out: IHP is full of magic, this is both good and bad.
[+] cies|5 years ago|reply
> IHP is full of magic, this is both good and bad.

I find that not true. Scaffolding is not magic. IHP has little magic compared to big names like Rails and Spring Boot.

What I find that IHP is full of: type safety saving my ass from runtime drama.

Totally agree on the docs remark, the community is very friendly though.

[+] ozmaverick72|5 years ago|reply
I've seen this come up on reddit ads - has anyone tried it out ? Does it live up to the claim that its Rail's for Haskell ? How does it compare to any of the other web frameworks out there ?
[+] lolinder|5 years ago|reply
I tried it out about a month ago, and my sense was it's definitely on the right track, but I wouldn't by any means put it into production yet. The UI was surprisingly useful rather than gimmicky, and the use of types was very cool. I was particularly impressed with the migrations framework, which was really easy to work with.

I didn't get too far into it, though, because at the time it didn't support the Haskell language server, which made exploring the framework hard. They've added support for that since then, so I'm looking forward to trying it again. I'd also love to hear people's experiences, if anyone has gotten further in it.

[+] sshine|5 years ago|reply
I tried it this weekend as I wanted to convert a Flask prototype into something in a typed language. I’ve used Servant (Haskell) for other prototypes. For this particular demo, there were more JSON REST endpoints than “pages”, so both Servant and Http4s (Scala) felt more natural here to me.

Installing it was easy, even though this was my first time using Nix. I think shipping things with Nix, especially when what you ship is integrated, can be superior in Haskell to using stack or cabal. (Stack is easier, cabal is more flexible, neither handle dependencies outside of Haskell.)

I’ll definitely come back and check it out for another prototype soon. :)

[+] themmes|5 years ago|reply
I'm using it for a hobby project! It's been great to actually be able to quickly build something while learning haskell, the folks on the slack are helpful and it's inspiring to see how quickly the framework develops.

I don't have any experience with Rails or other haskell frameworks.

[+] justatdotin|5 years ago|reply
I kind of like it. I haven't got far, but I think how it will work is to let it serve pages for the admin site, and provide JSON API to a stateful frontend.
[+] ibraheemdev|5 years ago|reply
How does this compare to Yesod [1]?

[1]: https://github.com/yesodweb/yesod

[+] _query|5 years ago|reply
Someone from the haskell community summarized it like this [0]:

> You thought Yesod was Rails? Nope. Yesod is a highly modular library for developing web applications with a few opinions and some scaffolds. > IHP is Rails - all the components are glued together in a way that makes modularity difficult.

The main difference is that IHP is very opinionated and cares a lot about giving a great developer experience. Where Yesod gives you 5 options to do things, IHP has one way to do it. This especially applies to the infrastructure: IHP takes care of installing the compiler, libraries and also provides a built-in dev server that automatically reloads your code.

Our standardized setup allows for a super quick way to get started building real things.

Another important thing is documentation. IHP has best-in-class documentation[1] with lot's of code examples. Compare it yourself:

Yesod: https://www.yesodweb.com/page/quickstart IHP: https://ihp.digitallyinduced.com/Guide/installation.html

[0]: https://twitter.com/mattoflambda/status/1275469470559907840 [1]: https://twitter.com/smdiehl/status/1276049218654912514

[+] etherio|5 years ago|reply
I wonder how this framework performs on speed. Rails is really nice but somewhat on the slow side, would be cool if the haskell alternative was more efficient.
[+] cies|5 years ago|reply
I did a test once with Yesod (also a Haskell based server side web framework; also uses Haskell's Warp webserver), and it was very fast. I got 60ms from Rails and 2ms from Yesod in a similar scenario.

This will not be fastest (that will be the C/C++/Rust solutions), but the programming experience is very high level. I want speed in runtime performance (1) and in developer productivity (2). I'd say Rust and Haskell have interesting offerings looking at these two metrics.

[+] keithnz|5 years ago|reply
Auto refresh seems a bit like phoenix's liveview? It sounds like the database hooks are a bit blunt, but I guess if your queries are low cost it could be quite responsive
[+] _query|5 years ago|reply
Yes, this is very similiar. We used it extensively to build IHP Cloud [0] where we have a lot of async background processing. AutoRefresh allows the view to be updated automatically when e.g. the deployment status changes without us writing any app-specific JS code. It's takes only a single line of haskell code, so it's implemented in seconds and then really just works :)

Would we have to use AJAX polling for that or would need to write Websocket Code manually, we'd need to spend way more time on that.

[0]: https://ihpcloud.com/

[+] jose_zap|5 years ago|reply
Has anyone used this in production? How is the performance of IHP like?
[+] pyuser583|5 years ago|reply
Why? What’s the point? Do we need another web framework? Are Haskell programmers spending too much time writing boilerplate for their web apps?

If this just a fun project then cool. I hoped the author learned something. I hope even more that they share what they learned.

[+] theCodeStig|5 years ago|reply
Good point. Here’s a different angle. I don’t see it, that the Haskell community needs another web framework. However, the niche that Rails fills, could benefit from purity and type safety; which Haskell provides.