16 ms·
Fable 3: F# to JavaScript compiler
- adamnemecek 6y agoI have been intrigued by the SAFE stack lately https://safe-stack.github.io/ https://safe-stack.github.io/. Does anyone have direct experience with it?
- JaggerJo 6y agoYep. We’re using F# React on the front-end, Giraffe on the back-end. DustyTables for Data Access. It’s great - can recommend.
- tartoran 6y agoIs the market for F# picking up now in 2020? At my current job we're not using F# but I'd like to eventually move to a place that does. I am learning on my own at the moment and am wondering how open the potential hiring companies would be with novices in F# who otherwise have good experience in other languages.
- JaggerJo 6y agoFrom my experience it’s still not easy to find an F# Job. It’s a niche, but it exists and is growing. If you want one and are willing to take a few compromises you’ll find one.
- nextos 6y agoI see a decent number of openings in the City of London quite regularly for finance and insurance positions. Also OCaml and sometimes Haskell. Even Rust has started popping up recently. I find this a bit intriguing because the library support for linear algebra, probability and statistics is pretty slim both in .NET and OCaml. The latter has OWL, which is very cool, but it's mostly a 1-person project. Do they develop all this support in house? For example, in insurance you may need things like Gumbel or Fréchet maximum likelihood estimators. That's not so easy to implement on your own, especially not without some linear algebra and optimization primitives available. On the other hand, I love these languages, and I wish there was a strongly typed contender to Python, R or Julia. Whenever I develop a data-oriented application, it feels like I need to prototype in one language and in order to scale or develop the whole infrastructure, I need to switch to another language. Julia has solved some of these problems, but I don't see a team implementing tons of business logic in a medium sized application using Julia.
- pjmlp 6y agoUsually on the .NET ecosystem such stuff just gets bought. https://www.quantconnect.com/blog/top-numerical-libraries-for-c/ https://www.quantconnect.com/blog/top-numerical-libraries-fo...
- KurtMueller 6y agoF# is your strongly typed contender to Python.
- nextos 6y agoSure, it's a lovely language. But I find the lack of some basic linear algebra, probability and statistics libraries frustrating. As pjmlp said in a parent thread, those are closed source and usually bought. I guess a lot of the .NET ecosystem is like that. It's a shame, because MS has some open-source jewels like Z3 or Infer.NET.
- KurtMueller 6y agoHopefully F# gets big enough that people will write those libraries - I think people deserve a better Python.
- mdm12 6y agoMS is making a conscious effort to push into the ML space with libraries such as ML.NET https://dotnet.microsoft.com/apps/machinelearning-ai/ml-dotnet https://dotnet.microsoft.com/apps/machinelearning-ai/ml-dotn... . IMO, the combination of a strongly-typed language with features such as type inference, data providers and discriminated unions/pattern matching make F# a perfect fit for this space. It's just unfortunate that they had to go through the .NET Framework -> .NET Core journey before focusing on the ML ecosystem... But, the F# PM has recently given talks recognizing that they want to go into the space that Python is dominating, so it's a clear goal of the F# team (https://www.youtube.com/watch?v=_QnbV6CAWXc https://www.youtube.com/watch?v=_QnbV6CAWXc). I hope they're successful!
- 6y ago
- Scuds 6y agothis is part of the greater lament of FP languages in industry. You might have to be satisfied with a kind of FP flavored C#, which in newer versions of the language isn't all that bad The thinking is that there's a million C# devs, a hundred thousand VB devs, and ten thousand F# devs. If you want to work in F# come up with your own OSS projects or champion it at work.
- merb 6y agowhat about efcore does it work in f#? or is it bad practice to use mutable code/objects in f#? i do not want to go back to plain sql...
- JaggerJo 6y agoIt’s a .Net library so it works (or should work) with F#. What sometimes leads to problems is F#’s record and discriminated union types. Not sure how they are handled by EF Core. Going back to plain SQL is just great. You know exactly what SQL gets executed. No Magic. With DustyTables it’s also not too much boilerplate.
- banashark 6y agoDesign-time support is still via a non-released package. So you'll write models/etc in C# and use EF from F#. There are ways to get design-time constructs working in F#, but it's not plug-and-play like from the C# side.
- angio 6y agoYou can write models in F# (with CLIMutables everywhere), but then you need to put models in a separate project, then add a C# project for migrations, and finally reference both projects from your ASP.NET app.
- ben509 6y agoApparently C# 7 can match discriminated unions quite well[1], with the caveats being: 1. you need a dummy type[2] for empty parts of the union. 2. it still can't enforce exhaustive matching. [1]: https://stu.dev/pattern-matching-fsharp-union-types-in-csharp/ https://stu.dev/pattern-matching-fsharp-union-types-in-cshar... [2]: Maybe () would work?
- troughway 6y agoFor those too lazy to hunt, SAFE stands for Saturn Azure App Service Fable Elmish Slightly off topic but it’s good to see that F# is finally getting some proper web love.
- rishav_sharan 6y agoNot SAFE, but there's a new web framework for f# at https://www.falcoframework.com/ https://www.falcoframework.com/. It's in functional first approach and built on top of asp .net I have only done some toy projects on it so far, but am really digging it.
- dfgdghdf 6y agoI am not using SAFE, but something similar: * Suave * AWS * Fable * React SAFR? It's great, but missing a snazzy acronym.
- deleted 6y ago[deleted]
- dvfjsdhgfv 6y agoThank you for the part in round brackets, I wish more submissions were formed in this way.
- Tabzz98 6y agoWouldn't have even clicked if not for the brackets. My mind jumped to the crappy game https://en.wikipedia.org/wiki/Fable_III https://en.wikipedia.org/wiki/Fable_III
- umvi 6y agoHuh, today I learned "parenthesis" are called "round brackets" in UK
- amelius 6y agoIs concurrency supported?
- JaggerJo 6y agowhat exactly do you mean by ‘concurrency’ ? F#’s async workflows are supported. Not sure how this is implemented behind the covers - I guess it get’s compiled to JS promises.
- amelius 6y ago> what exactly do you mean by ‘concurrency’ ? Good point. I guess I meant parallelism instead. https://stackoverflow.com/questions/1050222/what-is-the-difference-between-concurrency-and-parallelism https://stackoverflow.com/questions/1050222/what-is-the-diff...
- JaggerJo 6y agoNot supported IIRC as it’s not supported by JavaScript. I think it can still be archived with web workers.
- angio 6y agoAs already mentioned, you can use web workers. Feliz (a React library for F#) provides a nice way to use them [0]. [0] https://zaid-ajaj.github.io/Feliz/#/Hooks/UseWorker https://zaid-ajaj.github.io/Feliz/#/Hooks/UseWorker
- nbevans 6y agoYes - F# provides its own async model via an `async` computation expression. But you can also use the TPL in .NET BCL. F# 6 will have native support for TPL via a `task` computation expression. But honestly, its own async model is great - arguably better than TPL for business systems. It sacrifices a little top-end performance/power and in return you get a supremely clean abstraction.
- sp33der89 6y agoHow does Fable 3 stack up against ReScript or Scala.js? Is the only difference the ecosystem around the toolchains?
- banjomet 6y agoA better question is about ReasonML/ReScript.
- smt1 6y agoAnother Ocaml-ish option is of course, Rust. One thing it has additionally going for it is a complete node.js JS reimplementation (with deno.js, the runtime is mostly go inspired), a client side web browser JS/Webstack impl with bleeding edge webgpu, webasm, CSS support (servo, which was hoisted up to the Linux Foundation - https://servo.org https://servo.org). I think the ethos of servo is interesting since it should allow the web to more interesting dynamic web pages tailored for bandwidth, internationalization, and localization issues, thanks to the (years) of hardwork by IETF and w3c.
- jordwest 6y agoI haven't tried Fable 3 yet, but I can speak to Fable 2 (F#) vs ReScript/ReasonML (OCaml). F# was heavily inspired by OCaml, it was originally intended as "What would OCaml look like running on .NET?" so the languages themselves share a lot of similarities. ReasonML pros: - ReasonML compilation times were much faster than Fable 2, but Fable compile times weren't bad. OCaml is ridiculously fast. - OCaml has an interesting module system that's missing from F#. - The toolchain feels a lot more lightweight than the whole .NET toolchain. Fable pros: - I found interop with JS and OOP stuff much easier in Fable than in ReasonML - Fable has a tool for converting TypeScript definitions to Fable definitions - though it hasn't always worked for me for more complex type definitions - I prefer F#'s whitespace sensitive syntax over OCaml, but that's just personal preference - F# type providers are pretty cool - F# has an interactive mode, and you can write standalone scripts (eg. for devops) - If you want to write a web backend in the same language, F# on .NET is much more mature in the web space than OCaml.
- dfgdghdf 6y ago
- Scuds 6y agoI wonder how elm and clojurescript are doing?
- frozenlettuce 6y agoElm: https://www.reddit.com/r/elm/comments/jwzjnl/whats_with_all_the_open_pull_requests/ https://www.reddit.com/r/elm/comments/jwzjnl/whats_with_all_...
- vmchale 6y agoSee also: https://github.com/elm/compiler/issues/1773#issuecomment-418478847 https://github.com/elm/compiler/issues/1773#issuecomment-418... Dismissive maintainers indeed!
- mjaniczek 6y agoStill ready for production.
- vmchale 6y agoElm is definitely not ready for production, hostile compiler maintainers.
- matsemann 6y agoWritten elm daily in huge production apps for years now. I read about the drama on HN, but it doesn't really reflect how elm is to use. Everything works and been stable for a long time now. Would I recommend others to throw away React or similar to use it? Maybe not, but it's mostly painless to use day-to-day.
- RobertKerans 6y agoNah, it's totally fine in production. Now I'm not working at a company using it [in prod] I'll likely never touch it again, but it works and works very well.
- 6y ago
- dang 6y agoIf curious see also 2017 https://news.ycombinator.com/item?id=15578592 https://news.ycombinator.com/item?id=15578592 2016 https://news.ycombinator.com/item?id=11771266 https://news.ycombinator.com/item?id=11771266
- anonytrary 6y agoI find the name a bit funny, considering Fable 3 was by far the worst game in the Fable series. Yes, I know this has nothing to do with the video game.
- drannex 6y agoI'll be honest, F3, while the most hated was the one that I had the most fun. It was the more serious of the entire franchise and I liked the change of pace and the kingdom-wide choices (and becoming the King/Queen of the entire thing? Great fun.) that could happen based on your changes was a lot more 'real' than the previous two games. Don't even get me started on the total farce that was the Fable: The Journey was. Cool concept, poor implementation.
- christophilus 6y agoThis looks like a great update: prettier code output plus roughly double the compilation speed. Compilation speed is one of the things that put me off Fable when I kicked the tires a while ago. That and tooling was a mess. I really like F# as a language, but it's hard to give up the high quality tooling of VS Code + TypeScript + almost any NPM package w/ proper types.
- natchy 6y agoWas trying to use F# at work for a backend service and got shut down. Ended up using Typescript instead and it doesn't feel as clean.
- christophilus 6y agoTypeScript is nowhere near as clean as any FP language I’ve used. But it’s hard to deny that TypeScript has better tooling and 1st class library support.
- zamalek 6y ago> it's hard to give up the high quality tooling of VS Code + TypeScript + almost any NPM package w/ proper types. This is my gripe exactly. If you gave me Svelte# and we'd be talking (my TS is pretty functional otherwise).
- tejasv 6y agoWe're an F#-first company and I'd like to share our experience here. All our new code is in F#, we started off from a C# codebase, so that made the transition somewhat manageable, as new F# code can be directly called from C#, and vice versa (still took over 2 years). All new frontend apps are also being written in F# (using Fable), as of 6 months back, migrating away from TypeScript, this forces everyone into a "design your model first, and well" paradigm. We've written quite a bit of code to blur the lines between traditional backend and frontend development roles, so what we have now are: - product engineers (who write application logic on both frontend and backend to serve business needs) - platform & framework engineers (who write the underlying persistence/serialization/versioning/frontend-backend-sync websocket/load balancing/IDE extensions/deployment etc) - component designers who focus on visuals Platform/framework engineers try to encapsulate as much magic as possible into computation expressions (F#'s monads), so product engineers can focus simply on writing out business intent, with readability given very high priority. We also make ample use of quotations to do some cool tricks (like predict the future states some type can take, based on current state + available transitions). Our code written in F# has an order of magnitude fewer bugs when it makes it to production, given the amount of thought we pour in modelling the problem domain accurately, and thanks to functional programming itself. They're also more amenable to business requirements changing, simply because they've been modelled well to start with. Nothing that can't be achieved in other languages, but with F#, this happens more naturally. Almost everyone in our team has learnt F# on the job, and overall, everyone's experience has been extremely positive. There's a bit of difficulty in the first 2-3 months, as junior devs get introduced to functional thinking, but if you've generally being doing functional programming, this is just about learning new syntax, tooling and F#'s choice of operator naming (map/bind/pick/collect/choose/..). Typically, based on prior experience, we ask newcomers to spend two weeks to a month, solving the first 100 problems on Project Euler in F#, without using the mutable keyword, and we assign a mentor to point out best practices and review their code. The hiring pool for F# devs is much smaller than the regular applicant pool, but if a candidate shows genuine interest in F#, they are usually 10x more likely get through our interview process. If they've discovered F#, it means they find something lacking with mainstream languages, so they're likely to have many years of experience under their belt, and they've found a way to grow. That said, we don't restrict our hiring to simply F# devs. For more info about us, see chaldal.tech (YC/S15).
- s369610 6y agoFable isn't just for view logic. Fable is also really handy for writing puzzle solvers/generators for the browser. I used it in https://vowels.io https://vowels.io while using regular preact/js for the views. I found that keeping the fable stuff isolated to lib code gave me less friction.
- cambalache 6y agoNice site. I liked the game, I was embarrassingly slow though
- seankearon 6y agoYeah, a really nice site. It's not slow at all from what I'm seeing!
- cambalache 6y agoThe site was fast, I was slow solving the puzzles
- seankearon 6y agoOhhh, sorry - it must be my new glasses! :)
- nudpiedo 6y agomy experience was the same, although is it possible to do everything with Fable, it works better to glue frameworks with typescript and keep F# as library or some function calls in strategic points.
- arwhatever 6y agoI've had fantastic experiences with this platform as well, front- and back-end code compiled together using F#'s robust type system. Elmish framework provided a nice MVU pattern for the U/I. And the real icing on the cake was this Thoth.Elmish package which creates statically-typed proxy for your front-end to access your back-end API, more or less transparently. I was always certain that I would some day do something unorthodox causing its automated serialization/deserialization to fail in some difficult-to-troubleshoot way but no, that never happened and it all just worked transparently. This was hands down the best automated-correctness-checking experience that I've ever had in any framework.
- rigoleto 6y agoFor those interested, I believe you're referring to Fable.Remoting https://zaid-ajaj.github.io/Fable.Remoting/src/basics.html https://zaid-ajaj.github.io/Fable.Remoting/src/basics.html
- arwhatever 6y agoAnyone have any insight into how well the Ts2Fable tool works these days? (It translates TypeScript type definition files into F# for fable consumption.) https://github.com/fable-compiler/ts2fable https://github.com/fable-compiler/ts2fable I just now dumped a 350KB JQuery.d.ts file into it, and sure enough it spit out F#, but confirming how well it works overall would take a lot longer to ascertain. Always seemed to me like having a really robust tool for this purpose (or else, just a rich direct Fable-typing selection) would be a huge boon for the whole Fable ecosystem.
- plastman 6y agoI see some F# praising in here. any good learning resources one can recommend to me (Ik I can "google it" or whatever. I mean something you had experience with and would recommend)
- rodrigoj42 6y agohttp://fsharpforfunandprofit.com http://fsharpforfunandprofit.com The one true way (his book is also very good)
- coverj 6y agoBought the book as well and would recommend it. Also have a look at Scott's talks (links are on the website or search his name in youtube)
- deleted 6y ago[deleted]
- green-mind 6y agoHere is a brand new F# course on Udemy. Highly recommended! https://www.udemy.com/course/fsharp-from-the-ground-up/ https://www.udemy.com/course/fsharp-from-the-ground-up/
- gonesurfing 6y agoStylish F# is a good book to go with all of Scott’s works https://www.apress.com/gp/book/9781484239995 https://www.apress.com/gp/book/9781484239995
- reverseblade2 6y agohttps://www.udemy.com/course/learning-functional-programming-with-f/ https://www.udemy.com/course/learning-functional-programming... https://www.udemy.com/course/functional-application-designing/ https://www.udemy.com/course/functional-application-designin... https://www.udemy.com/course/end-to-end-real-world-application-development-with-f/ https://www.udemy.com/course/end-to-end-real-world-applicati...
- sriku 6y agoCan anyone with experience with Fable - - compare their experience with ReasonML since they both have the same OcaML pedigree - offer any perspectives on efficiencies of various constructs? For example, do things like seq add additional complexity or are about as efficient as for loops? - discuss the output size .. by virtue of using .net libraries versus javascript builtins?
- tesmar2 6y agoIs there any note on if F# will gain concepts/type classes?
- gonesurfing 6y agoI don’t know, but I think this GitHub issue will probably give you the current status and background on this point https://github.com/fsharp/fslang-suggestions/issues/243 https://github.com/fsharp/fslang-suggestions/issues/243 Update: the issue is tagged await-csharp-alignment, which is probably the relevant status.
- tesmar2 6y agoAh thanks!
- chrischen 6y agoWe’ve started adopting ReasonML on the server side (using nodejs as the end runtime). Anybody have ides on why ReScript/ReasonML on the server side isn’t more popular or targeted? Initially I considered F# and Fable but decided I wanted to adopt the same stack for the client side as well.
- reverseblade2 6y agohere's a 3d bin packer written in Fable: http://bindrake.com/ http://bindrake.com/ and source: https://github.com/OnurGumus/BinDrake https://github.com/OnurGumus/BinDrake
- _jsdw 6y agoDoes anybody here use F# in a Linux shop? I'm generally keen on the more functional languages, but have tended to avoid F# under the assumption that if I use F# I'll probably also end up needing to use Windows to get the most out of it (or get a job using it).
- natchy 6y agoI do a lot of F# these days. I haven’t owned a windows machine in a decade.
- JackMorgan 6y agoI used it years ago in a Linux shop using Mono. It was perfectly fine. I gather these days with the new .NET Core running natively on Linux it's even better.
- Nelkins 6y agoAt my previous company I developed on Ubuntu/macOS and deployed to Linux on AWS. Never experienced any issues, never had code running on Windows.
- aaronmu 6y agoUsing F# on Ubuntu for two years, it’s lovely!
- angio 6y ago.NET Core on Linux is actually the best experience I had in a while. Microsoft provides packages for all the major versions of the SDK and you can install them side-by-side with your distro package manager. Then you pick which version of the SDK you want to use for each solution and everything works.
- KurtMueller 6y agoI've been writing code with f# and dotnet core 5.0 on MacOS. Works great!
- McWobbleston 6y agoWe've been using it in production for a web service for over a year now, it's been a pleasant experience. dotnet core and ASP.NET are great platforms/ecosystems and F# has no trouble piggybacking off all that success.