5 ms·
Why not show a code sample on the homepage? None of Home, Docs, or Samples have a single code snippet on the entire page, you have to click through. Crystal an
by JasonSage 9y ago
Why not show a code sample on the homepage? None of Home, Docs, or Samples have a single code snippet on the entire page, you have to click through.
Crystal and Rust are good examples of language homepages that give you an idea of what you're getting into up front. Or for a transpiled language, PureScript.
- vertex-four 9y agoFable is a compiler and runtime for a language that already very much exists, and has its own documentation and landing page. F# isn't a new thing.
- kristiandupont 9y agoSure, but I would still like to see how I would use this in the context of a browser. How do I interact with existing JS libraries? How would I use it with React or something else? How would I even call window.alert()?
- piaste 9y agoFor React, install the appropriate library[1] and then call the functions you need from the Fable.Helpers.React.* namespace. If you want to see a complete implementation of Fable + React in action, the canonical example is https://github.com/SAFE-Stack/SAFE-BookStore https://github.com/SAFE-Stack/SAFE-BookStore For alert(), you'll find it in Fable.Import.Browser.window.alert() (In case you're wondering, the Fable convention is that the Fable.Import.* namespace is used for pure JS bindings with no business code, while libraries with an actual translation layer are placed in the Fable.Helpers.* namespace.) [1] https://www.nuget.org/packages/Fable.React/ https://www.nuget.org/packages/Fable.React/
- wtetzner 9y agoThe front page has a link directly to the F# website: http://fsharp.org/ http://fsharp.org/, which has a bunch of resources to learn the language.
- benaadams 9y agoF# website its also hard to find an example of the code
- lanestp 9y agoI actually agree. Showing an example of something that is hard and common in JavaScript but easy in F# would help justify using this.
- keithnz 9y agoyou can go to the samples... but you will quickly notice a lot of the samples are canvas orineted things, because Fable gets to be in control to do things F# like. There's a vue and react example, but the code doesn't show any real advantage. Very little examples of typical web pages.... just a link to fable-elmish..... so... you may as well use elm. This is a common problem for F# in general, it hasn't really carved a slice of a world where it dominates. It's a nice language, but hard to make it a first choice. Though one area I think it's quite nice is parsing, I like FParsec
- et1975 9y agoHi, fable-elmish author here. Elm is great if you don't care about investing into two ecosystems or don't have a backend, or don't have a Native client in addition to Web, or don't care about what JS ecosystem has to offer. Fable lets one use F# for both frontend and backend, and being able to share the code (models in particular, but really anything) while maintaining clear separation of tiers reduces your code base and dramatically improves quality w/o the need for elaborate tests. Fable-elmish lets one use the same frontend code and architecture to write Native and Web apps. Again, YMMV, but at our company being able to transition an entire team between completely different types of projects avoids expertise silos and makes truly cross-functional teams possible. We have OSSed a lot of our backend tech that helps building event-driven system in F# as well, in case anyone's interested: https://prolucid.github.io https://prolucid.github.io. As Tomas said, just like Lisp in Paul Graham's "Beating the Averages" has been his secret weapon, F# is ours.
- MangelMaxime 9y agoThis is true we still need to work on promoting our documentation and samples. We are a small team working on it, and we try to constantly improve it. I will provide you some links here if you can find them useful: - File explorer using electron: https://github.com/fable-compiler/samples-electron#samples https://github.com/fable-compiler/samples-electron#samples - Pixi.js samples (quite new we are working on them): https://github.com/fable-compiler/samples-pixi/ https://github.com/fable-compiler/samples-pixi/ - Elmish central website: https://fable-elmish.github.io/ https://fable-elmish.github.io/ - Bulma wrapper for Elmish: https://mangelmaxime.github.io/Fulma/ https://mangelmaxime.github.io/Fulma/ - A demo of Fulma + Elmish - Live demo: https://mangelmaxime.github.io/fulma-demo/ - Source code: https://github.com/MangelMaxime/fulma-demo And also, a really cool place is Fable awesome: https://github.com/kunjee17/awesome-fable https://github.com/kunjee17/awesome-fable
- mizzle-mo 9y agoYou can see examples here: http://fable.io/repl http://fable.io/repl