dream
yesod-persistent
Our great sponsors
dream | yesod-persistent | |
---|---|---|
9 | 10 | |
1,514 | 2,590 | |
- | 0.4% | |
8.4 | 6.6 | |
3 months ago | 15 days ago | |
OCaml | Haskell | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
dream
-
Ask HN: What Happened to Elm?
> It sounds like you read my statement as "run the exact same code in node or OCaml" which I agree would have been very hard.
Hello! Indeed, I did misunderstand you. I agree that it was possible to share some parts of the code between Reason's JS target with BuckleScript, and native target with the stock OCaml compiler. I think a pretty reasonable number of people did that. Actually, it's still possible to this day even with ReScript e.g. https://github.com/aantron/dream/tree/master/example/w-fulls...
> Between the breaking changes and the general change in development philosophy...switching to the ReScript compiler for my project would have required nearly a complete rewrite.
There were perhaps a couple of minor breaking changes but can you explain why it would have required a near complete rewrite? I wasn't aware of anything major like that. ReScript even supported and as far as I know, to this day continues to support the old Reason syntax.
-
Functional Reactive Programming
> you might want to check out OCaml for general purpose programming
Any tips on backend frameworks to look at? I need to write a small websocket service for a side-project and have always wanted to try OCaml. I came across https://github.com/aantron/dream.
-
so people are making these
The framework I played around with for OCaml was called Dream: https://github.com/aantron/dream. I think it had built-in support for auth, but I didn't use it in what I was doing. I also barely scratched the surface of what it supported. On the whole, it seemed really nice though. The biggest issues I had were figuring out OCaml since I'd literally never used it before and figuring out how to make an HTTP call from within OCaml since the documentation can be iffy. Thankfully, Dream's documentation was actually reasonably good.
- The New OCaml Website
-
Dream – Tidy Web Framework for OCaml and ReasonML
Yes. OCaml + all of the 3 OCaml-to-JS compilers support OCaml syntax.
Dream itself demonstrates:
- Server and client both written in Reason, using ocamlc+Melange https://github.com/aantron/dream/tree/master/example/r-fulls...
That example could also have been written in OCaml syntax, because ocamlc (native) and Melange (JS) both support OCaml. However, Reason is nicer if you want to use React with JSX.
- Server and client both written in OCaml, using ocamlc+Js_of_ocaml https://github.com/aantron/dream/tree/master/example/w-fulls...
The remaining example uses Ocaml on the server and ReScript on the client, using the ReScript compiler. However, you could use OCaml on the client with the ReScript compiler. Just as with Melange, you would lose access to nice JSX syntax https://github.com/aantron/dream/tree/master/example/r-fulls...
It's definitely a lot and not user-friendly to have to decide between all these options, but the community is experimenting greatly right now... so it's good and bad, and that's how it is :/
As for Node.js, using ReScript syntax requires you to use Node.js on the native side, but that is the only coupling. If you write your native side in OCaml or Reason, you can compile it to native code with ocamlc (technically, ocamlopt is the internal command; nobody uses either one directly, but the build system calls them).
yesod-persistent
- It's 2023, so of course I'm learning Common Lisp
-
so people are making these
I also looked into Snap (http://snapframework.com/) and Yesod (https://www.yesodweb.com/) for Haskell. I didn't really get anywhere with those though because I had build issues with dependencies and was in a bit of a hurry so I put them off for later.
-
[ANNOUNCE] GHC 9.4.1-alpha2 now available
If you have a yesod app and want to try this out, I've got a cabal.project that works for yesod and persistent: https://github.com/yesodweb/yesod/pull/1769
-
Should a noob consider learning Haskell for web back end?
It would be an unorthodox choice. If you're looking to use this personal site as a portfolio project, you'd probably be better off using something like Node (JS), Java, or Python which tend to be a bit more marketable. However, if you want to try learning Haskell, then building a personal site with it seems like a great way to dive in. If you want to learn a bit more, Yesod seems to be the most well-documented Haskell web framework
-
Does Haskell have a Laravel like framework ?
I believe yesod is the go-to all encompassing framework.
-
On a daily base in this sub
frameworks like yesod and IHP
-
Writing a Wiki-Server with Yesod
In this blog post I’m presenting an implementation of a Wiki System in the spirit of the legendary C2-Wiki - written in Haskell with the Yesod framework.
-
New blog post: Type-level sharing in Haskell, now
I'm wondering if this is related to this.
-
The Importance of Humility in Software Development
> Every language phasing the web is stringly typed
Heh, not even close. Off the top of my head I can think of Ur/Web as an extreme example ( http://www.impredicative.com/ur ), and slightly more mainstream systems like Yesod ( https://www.yesodweb.com ). I've worked professionally with Haskell, although not for Web stuff. These days I mostly work with Scala, which has a similar typing mindset to ML/Haskell, but unfortunately inherits a lot of stringly typed legacy from Java. We use an in-house library that provides zero-cost newtypes to distinguish between different semantically-distinct data types, many of which just-so-happen to be representable as subsets of String (e.g. GET parameter names, GET parameter values, POST bodies, etc.). This makes it a type error to try and e.g. concatenate different sorts of data together.
W.r.t. "escaping", I tend to avoid it entirely since it's inherently unsafe:
- "Escaping" doesn't distinguish between its input and output types; they're both just "String", and we have to make assumptions about the contents of each (i.e. it's unsafe)
- Having the same input and output types makes it possible to "double-escape" by accident. This discourages the use of escaping, just-in-case it happens to be done elsewhere; hence it's very common to end up without any escaping taking place.
- Having the same input and output types makes escaping functionally unnecessary: anything we do to an escaped string could also be done to an unescaped string, so it's up to us to remember that it's needed (i.e. it's unsafe).
The whole idea of "escaping a string" betrays a flawed approach to the problem. Instead of throwing everything into the same representation, then manually trying to figure out whether or not a value comes from a particular subset of that representation or not, it's much easier and safer to avoid lumping them all together in the first place. If our inputs have a certain type (e.g. HTTP.Get.Val) and we can only output certain other types (e.g. JSON, Map[HTTP.Header.Key, HTTP.Header.Val], etc.), then the processing which turns input into output is forced to specify any necessary conversions. Whilst such conversions may involve escape sequences, having them associated to particular types is more akin to serialisation.
Heck, at my first PHP job we largely solved this problem not by 'filtering and escaping', but by modifying the PHP interpreter to distinguish between 'clean' and 'dirty' strings (with literals being clean, and $_GET, etc. being dirty). Operations like concatenation would propagate 'dirtiness', and output functions like 'echo' would crash if given a dirty string. Traditional 'escaping' functions would convert dirty strings to clean ones, and crash when given a clean string. Having this be dynamic was more annoying than ahead-of-time compile errors, but it still did a pretty good job.
There's pretty much no excuse for stringly typed languages/libraries/etc. when such such trivial solutions exist, other than the historical inertia of legacy systems.
-
Starting a project that depends on a module with a custom Prelude: mixins, cabal, and yesod-bin
The project is going to make use of Warp. To smoothen the development process I set up yesod-bin according to their template for non-yesod projects. This worked fine initially, giving me hot reloading on file changes, but after adding the private package as described above it's giving the following error:
What are some alternatives?
rescript-compiler - The compiler for ReScript.
graphql - Haskell GraphQL implementation
sihl - A modular functional web framework
swagger-petstore - swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
opium - Sinatra like web toolkit for OCaml
swagger2 - Swagger 2.0 data model.
lwt - OCaml promises and concurrent I/O
yesod-auth-hashdb - Yesod.Auth.HashDB plugin, now moved out of main yesod-auth package
ocaml-webmachine - A REST toolkit for OCaml
tiny-scheduler - no-brainer job scheduler for haskell
httpaf - A high performance, memory efficient, and scalable web server written in OCaml
inquire