1,262 karma · joined March 7, 2014
https://www.digitallyinduced.com/
marc a t digitallyinduced com
Initially we've only used nix for development at my company, but now we're also running most of our servers with NixOS. This allows us to use our dev package definitions in production, so our dependencies are always in sync between dev and prod. I've written a blog post about all the advantages we get with nix in our framework IHP a while ago, if you're curious, check it out: https://ihp.digitallyinduced.com/blog/2020-07-22-why-ihp-is-...
If you're using an older mac and have troubles with installing nix, try out the new installer in this GH issue: https://github.com/NixOS/nix/pull/4289 (the command is in the "Try it out" section). It's already merged, but not released yet. So far this has solved all the issues on older macs for me.
Also check out https://nix.dev/ which has many great resources to get started :)
There's now the IHP framework that allows you to build haskell web apps in like 10 minutes. If you're curious, check it out: https://www.youtube.com/watch?v=UbDtS_mUMpI It's been called "Haskell on Rails", and for good reason.
If you combine the approach of WebSockets + dom patching with postgres pg_notify you get some real magic :) In the new IHP framework we provide something like that. We call it Auto Refresh: https://ihp.digitallyinduced.com/Guide/auto-refresh.html
Auto Refresh is activated with a function call inside a controller action, like this:
action ShowProjectAction { projectId } = autoRefresh do
project <- fetch projectId
render ShowView { .. }
The only difference to a normal IHP action is that it has the `autoRefresh` call in front of the do-block.Once activated IHP will automatically track all tables your action is using e.g. in `SELECT * FROM ...` queries. Once the action sends a response IHP will start watching for any kind of `INSERT`, `UPDATE` or `DELETE` statement to all the tables used by your action using pg_notify.
When the page is rendered a small JavaScript function will connect back to the IHP server using a WebSocket connection.
Whenever an `INSERT`, `UPDATE` or `DELETE` happens to the tables used by your action IHP will rerun your action on the server-side. When the generated HTML looks different than the HTML generated on the initial page load it will send the new HTML to the browser using the WebSocket connection. The JavaScript listening on the WebSocket will use the new HTML to update the current page. It uses morphdom to only touch the parts of your current DOM that have changed.
Here's how this looks in the real world: https://twitter.com/digitallyinduce/status/13207288333943808... <- This view has no app-specific Javascript. The auto refresh is enabled using a single function call and the framework takes care of all the technical details.
Some use cases where this really shines:
- interactive dashboards (e.g. showing the current status of job queue)
- simple user chat systems (you can send messages using normal form submission, as long as auto refresh is enabled this works like a SPA)
- building a twitter clone, the feed will automatically add new content as it's added to the database
We're using this approach in production since last year and it saves an incredible amount of development time.
https://star-history.t9t.io/#digitallyinduced/ihp&yesodweb/y...
We also have a very active community, e.g. over 100 people in Slack, over 180 in Gitter, over 100 weekly active projects (https://ihp-telemetry.digitallyinduced.com/admin/Events <- here's some telemetry)
E.g. with Haskell Language Server there's now a good and standard way for having autocompletion, etc. inside VSCode and other editors.
In the web development space we now have IHP, which is like rails but with type-safety. It's already the second largest haskell framework, even though it was just launched last year: https://ihp.digitallyinduced.com/ (Disclaimer: I'm founder of the company that makes IHP)
I think this only might be a problem if you don't want to hire remote.
This is very true. We recently started https://github.com/digitallyinduced/haskell-ux to keep track of haskell DX improvements. Some of our suggestions are already issues on the GHC (haskell compiler) bug tracker.
Here's an example of a great UX improvement in GHC: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4711
Haskell is great for this because:
- In dev mode it's super fast, see https://www.youtube.com/watch?v=nTjjDo57B8g&feature=youtu.be
- You can change features of your product easier thanks to the type system. Doing a big refactoring with rails always adds many bugs. With haskell you spend less time on doing these kind of changes because the compiler tells you what needs to be changed.
Correctness is indeed not the most important thing, it's kind of a nice side effect.
Thanks to it's type system you can build much more stable web apps in less time. Usually later in the application life cycle you have a hard time refactoring stuff when working with e.g. JS or rails. Without tests you will definitly break stuff. With haskell you can confidently refactor your code without worrying about breaking stuff, the compiler will tell you.
The way data structure are declared in haskell is also very nice for domain modeling. You don't have as much boilerplate as e.g. when using PHP with doctrine.
The performance is also pretty good compared to python or rails.
This! The haskell ecosystem is missing a certain kind of pragmatism. There's a lot of beautiful type abstractions, talking about monads, etc., but not enough builders doing actual application development. In my opinion it's not the language that is bad, but the ecosystem. Missing documentation, missing tooling and infrastructure, no focus on actually building applications.
We're trying to fix that with IHP, a new haskell framework with a focus on actual building applications. Imagine the productiveness of rails combined with the typesafety of haskell.
6 months after it's release it's already the second biggest haskell framework, and we just had a new record of weekly active users last week. To me this shows that by fixing the ecosystem haskell can reach a lot more than it's currently doing.
Check it out: https://ihp.digitallyinduced.com/ GitHub: https://github.com/digitallyinduced/ihp
Here's a "boring" internal management system: https://twitter.com/fegundersen/status/1325534608079941633
Disclaimer: Founder of digitally induced, the company that helps make boring things with IHP+Haskell :)
IHP has around 230 monthly active projects at the moment, and it's growing fast. It was released 8 months ago and now is already the second biggest haskell web framework :)
I think haskell has been previously tragically underused because it was missing good documentation and pragmatic solutions that help you to get things done. Atleast in the web dev space this has changed this year. Watch our IHP demo video and you'll get it: https://www.youtube.com/watch?v=UbDtS_mUMpI
Disclaimer: Founder of digitally induced, the company that makes IHP.
For custom URLs check this: https://ihp.digitallyinduced.com/Guide/routing.html#custom-r... For JSON check this: https://ihp.digitallyinduced.com/Guide/view.html#json
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.
> 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
> 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)
https://ihp.digitallyinduced.com/
Disclaimer: Founder of digitally induced, the company that makes IHP :)
We mainly added the warning in that release because usually the update process is very smooth and takes only one minute, e.g. see this tweet: https://twitter.com/mittie/status/1322574176792825861
It's a truly batteries-included way to get started with building real world haskell web apps in minutes.
IHP's templating HSX is targeted at people with a react background that are familiar with JSX syntax. In the background it compiles down to blaze-html and can be used together with e.g. forM_ (which we have aliased to forEach). It's just a more familiar syntax on top of blaze html.
Some internal IHP functions are even still implemented with the blaze combinators: https://github.com/digitallyinduced/ihp/blob/master/IHP/View...
> They've reinvented common operators. For example, (|>), which is great, I've used it in Elm, but the Haskell version of this is (&) from Data.Function.
The |> just looks more beautiful to us :) Take a look at the gorgeous expressiveness of this: https://twitter.com/digitallyinduce/status/12990709068542484...
> They're ignoring Haskell conventions to make it more familiar to people coming from other backgrounds,
Yes, IHP is the haskell framework for builders :-)
Check out e.g. 100 days of haskell by Lars Ulvestad: https://driftercode.com/blog/hundred-days-of-haskell-day-one...
Started around 60 days ago, and now here's the soon-to-be-production app: https://twitter.com/larsparsfromage/status/13149985667761725... :)
Check the deployment guide for more details: https://ihp.digitallyinduced.com/Guide/deployment.html
There's also IHP Cloud which is basically "netlify for haskell". Here's a video of deploying a IHP haskell app in 60 seconds: https://twitter.com/digitallyinduce/status/13134104697854074... More infos here: https://ihpcloud.com/