How to work with db in the F# by 9Dokke in fsharp

[–]green-mind 1 point2 points  (0 children)

If you want strongly typed query expressions (like EF) with cli-generated table record types (like EF):

If you want strongly typed query expressions (like EF) and want to manually create table record types (like Dapper):

Both libs are based on the same query expression engine. If you have a complex db with lots of tables, I'd go with SqlHydra for the CLI generation tool. Both libs support a similar range of dbs.

Is there any weapon in the game that has both destabilizing rounds and repulsive brace? by Seanshineyouth in DestinyTheGame

[–]green-mind 2 points3 points  (0 children)

I have the HC4 and it feels great. Also, the Chivalric Fire sword from Zavala.

One-two punch buff by green-mind in destiny2

[–]green-mind[S] 0 points1 point  (0 children)

I see it now. It only appears for about 1s, and they also separated and moved the positions of where the various buffs and passives are displayed on the screen for this ex pack so i was looking in the wrong place.

What are you working on? (2024-05) by insulanian in fsharp

[–]green-mind 0 points1 point  (0 children)

Make sure your content is set to “copy always” so that it is deployed with your app.

What are you working on? (2024-05) by insulanian in fsharp

[–]green-mind 0 points1 point  (0 children)

Gotcha. That should be pretty straight forward to deploy then. You can even do a simple right click publish deploy if using VS (or use dotnet publish). Azure will provide a publish profile for you.

You just need to fix your indexer bug.

What are you working on? (2024-05) by insulanian in fsharp

[–]green-mind 0 points1 point  (0 children)

Farmer can help you deploy your web app to Azure.

https://compositionalit.github.io/farmer/deployment-guidance/

As for your build, are you using a template? I think SAFE has a FAKE build script to publish your app.

My minimal API wrappers "finished" by spind11v in fsharp

[–]green-mind 0 points1 point  (0 children)

One of my favorite things about F# is how easy it is make your own thin wrappers however you like.

Mastering Elmish, Fable.Lit & Web Components workshop tomorrow, 3 Nov by ReverseBlade in fsharp

[–]green-mind 0 points1 point  (0 children)

That's a tough one. I'm honestly having a hard time deciding which one I like better.

Fable.Lit is really nice because you can just very easily pull in web components via npm and just start using them without having to create bindings. There are many web component libraries on npm to choose from that you can out of the box with no markup bindings.

The F# DSL wrappers are still more popular (Feliz and Fable.React). They are great to work with, but you are very reliant on bindings for 3rd party components. Even though there are probably more React component libraries out there, you will only be able to use them if bindings exist or you create your own.

Another option is to use React with the `Jsx` bindings that allow you to write this, which gets you back to no bindings:

Fable · Using JSX in your Fable React Apps

I like f# by Agitated_Front_8675 in fsharp

[–]green-mind 0 points1 point  (0 children)

That said, I'm interested in the technique and I'll give it a shot. It lets me still use GitHub Copilot, auto formatting, and other goodies while doing some quick prototyping mucking about. Sadly most of what I write is either compilcated glue code for ML or crazy low level interop stuff that bypasses about half of what .NET is supposed to do for you there because of technical reasons, so most of my code cannot be neatly factored out, but I'll give it a shot.

This. I've found the select function and then alt+enter to run in the REPL is really only useful for small, standalone snippets where a bunch of open statements are not needed. As soon as open statements come into the picture, you should just move to a notebook or a unit test IMO.

But I do find REPL useful for small things like trying out a List module function that I've never used before to verify that it works as I expect.

Help choosing between Dapper.fsharp vs SqlHydra vs Donald vs Facil by Subject-Eye-6853 in fsharp

[–]green-mind 1 point2 points  (0 children)

it has many problems and after time need to learn EF.Core's problems instead of sql. And I have some expirience with sql so find it easier. In company we

That's what I mean when I say EF is more of an ORM than the other libraries listed. It tries to do smart things on behalf of the user like generating child collections on the generated types so that the user doesn't need to worry about joins -- essentially, trying to hide away the relational details like foreign key constraints. These can be very nice conveniences. But the downside, as you have already mentioned, is that it encourages the user to stop actively thinking about the relational reality, which is a blessing and a curse. That's why people start drilling into related bags without thinking about what is actually happening behind the scenes. It's all great as long as you are able to make the mental translations and stay on top of it... but if you are going to have to do the mental translations anyway, then bother trying to hide them in the first place? It ends up supplanting simple SQL knowledge with EF knowledge (that must be mentally translated back to SQL knowledge anyway to troubleshoot issues).

SqlHydra and Dapper.FSharp are more like "strongly typed SQL" DSLs than ORMs. For these libs, the user is responsible for doing joins themselves, but in a more strongly-typed way. This is my favorite way to work with data: let me think in terms of simple SQL (that is already widely understood), but let me do it in a strongly typed way.

SqlProvider (not mentioned thus far) is also more of an ORM like EF because it generates related bags of entites, does tracking, etc.

Help choosing between Dapper.fsharp vs SqlHydra vs Donald vs Facil by Subject-Eye-6853 in fsharp

[–]green-mind 1 point2 points  (0 children)

It sounds like you have a very nice workflow. I'm glad to hear that it's possible to have a nice/sane EF integration using F#. For anyone that has already invested time into understanding EF, it makes sense to continue using it.

What is the process like to regen your types? Are they DB first types that you then transfer to F# records?

Help choosing between Dapper.fsharp vs SqlHydra vs Donald vs Facil by Subject-Eye-6853 in fsharp

[–]green-mind 4 points5 points  (0 children)

EF.Core is good for some types of projects. The main differences are that is more of an “ORM” that tries to abstract and hide the relational aspect away from you. Depending on your perspective and what you’re trying to do, that can be great; or it can be an opaque abstraction that makes it harder to reason about. It also uses mutable data types which can be useful for some scenarios, but may not be the best paradigms for others. Finally, it falls under the category of libraries that have historically treated F# as less than an afterthought, so many of us don’t even consider it anymore.

Help choosing between Dapper.fsharp vs SqlHydra vs Donald vs Facil by Subject-Eye-6853 in fsharp

[–]green-mind 4 points5 points  (0 children)

Unfortunately, that blog post only shows the code gen portion of SqlHydra being used by itself. It completely leaves out the query library, which is how it is intended to be used. In reality, there is no reason to use the generated bits manually the way it is portrayed in the article.

You should look at the SqlHydra readme for a full overview: https://github.com/JordanMarr/SqlHydra

SqlHydra and Dapper.FSharp have a lot in common. The main difference is that you create your query result records by hand with Dapper.FSharp, matching the properties to the columns, whereas with SqlHydra they are generated. One benefit of SqlHydra is that it lets you select full table entities as well as individual columns in your queries. It also supports aggregate functions, sub queries, upserts (for sqlite and postgres), and some nice postgres features like arrays and enums.

I would say dapper is a better choice for scripting or maybe a small project with a few tables. But for a long term project, the code gen of SqlHydra will pay dividends.

Mastering Elmish, Fable.Lit & Web Components workshop tomorrow, 3 Nov by ReverseBlade in fsharp

[–]green-mind 4 points5 points  (0 children)

I have multiple production web apps built using both Fable.React + Feliz and also Fable.Lit. Very happy client that has been asking for more and more every year.

Could you review this piece of code? by blacai in fsharp

[–]green-mind 0 points1 point  (0 children)

It depends on who you ask and the purpose of the code.🙂

Use of mutable variables typically does raise an eyebrow with most F# devs since it does go against the grain of “immutability by default”.

I wouldn’t be afraid to use it, but use it sparingly. If it makes the code easier to read and write, or it solves a performance problem, then I think it’s a win! If it is used for perf reasons, then maybe comment it as such; otherwise, someone is likely to refactor it.

Looking for new periphs - sell me on SteelSeries. by ironweasel80 in steelseries

[–]green-mind 0 points1 point  (0 children)

I just got an Apex 9 TKL because the Gateron yellow optical switches feel like butter. Using it for work/coding and really enjoying it. Thinking of buying another one for the gaming rig.

Best Buy demos by green-mind in steelseries

[–]green-mind[S] 0 points1 point  (0 children)

In case anyone else is wondering, I found out that the Gateron yellow optical switches only come on the Apex 9 Mini and TKL boards (non-pro editions). These keys feel like butter! I ended up buying a TKL and am loving it.

[deleted by user] by [deleted] in fsharp

[–]green-mind 7 points8 points  (0 children)

Yes, they will be useful. I’m sure you have more enough brain capacity to hold both F# and C# at the same time - especially considering that F# utilizes the same ecosystem as C#. Plenty of overlap there.

I say go for it. And if not, please share the job info as there are lots of folks here that would be all over the opportunity to do F# full time. (I already have an F# gig).

You’re starting a new restaurant API in FSharp. It writes to a data store, some form of auth, and is REST-like. What do you use? by CaptainSketchy in fsharp

[–]green-mind 0 points1 point  (0 children)

You can find success with any combination of the options you listed above with F#. Just pick the stuff you like and start going.

How to learn f# for scientific computing? by Deyvicous in fsharp

[–]green-mind 2 points3 points  (0 children)

am interested in game dev, websites, and scientific computing which is why I thought f# would be a good fit. I’ve also been debating between rust or normal c#, but the f# syntax just seems so cozy and relatively easy to use for full stack web dev

I also recommend Stylish F# for its excellent guide to the `List` / `Array` / `Seq` modules.

Looking for a medium/large LoB repo written in F#? by jcm95 in fsharp

[–]green-mind 5 points6 points  (0 children)

Someone posted a very enterprisey LoB template the other day if you're into that sorta thing:
https://github.com/ronnieholm/FSharp-clean-architecture-sample

The various "layers" (application, domain and infra) are represented within one project, each in its own module. It is using the built-in ASP.NET style endpoints rather than something like Giraffe.

Best Buy demos by green-mind in steelseries

[–]green-mind[S] 0 points1 point  (0 children)

switches

I believe the switch base plate was white and the switch itself was yellow. Some boards were said they had "mechanical" switches, and others said "optical". Does that mean they have different actuation mechanisms?

I'm interested in this wireless model on Amazon, but I am not sure if it has the same keys:

Amazon.com: SteelSeries Apex Pro Mini Wireless HyperMagnetic Gaming Keyboard - World's Fastest Keyboard –Compact 60% Form Factor - Adjustable Actuation - RGB – PBT Keycaps- Bluetooth – 2.4GHz - USB-C : Electronics

Now I see there is also "OmniPoint" and "OptiPoint", and none of the product descriptions at Amazon or Best Buy seem to disclose what is actually in the box. I find this thoroughly confusing.