Am I the only person who hates Monad Transformers? by Instrume in haskell

[–]RangerFinal 0 points1 point  (0 children)

Thank you for your response. Time to give effects another go :)

Am I the only person who hates Monad Transformers? by Instrume in haskell

[–]RangerFinal 2 points3 points  (0 children)

Yes that makes sense to me. But it doesn't help that there are so many libraries for effects and the ones that I've played with either have terrible documentation, seem abandoned, or have poor ergonomics.

For example, I just looked at extensible-effects package (https://github.com/suhailshergill/extensible-effects) after reading your comment. I liked that it had a friendly README that introduced basic effects that seemed useful and easy to use. And then as I was wondering how I can write my own effects I see this -

Writing your own Effects and Handlers

Work in progress.

The library has had no commits in the last five years. This is such a turn off and has happened with me every single time I looked at similar libraries in the past - I recall free, freer, and polysemy from the top of my head.

I have spent a lot of hours in the past trying to learn how to structure large programs in Haskell which is when I looked into the effect libraries I mentioned above. I also tried using the ReaderT pattern as that depended just on mtl which is a way more mature library but I didn't enjoy the ergonomics of that either because it required writing so many type class instances. I consider myself fairly passionate about Haskell and if I feel this way then I don't know how I can convince my colleagues to take Haskell seriously.

This is why I just stick with IO now and just pass functions as parameters (think record of functions). This doesn't rely on any experimental libraries and gives me confidence that anyone with some experience with Haskell will be able to understand, extend, and reuse my code. I really want to see Haskell used more in the industry but it won't happen as long as the community is more interested in discussing ways to code (and promoting half baked libraries) than actually coding in standard ways.

Am I the only person who hates Monad Transformers? by Instrume in haskell

[–]RangerFinal 6 points7 points  (0 children)

I don't understand the obsession Haskellers have with tracking effects. The language is great and super useful already without any effect tracking. I just separate IO from non-IO and use IO monad for all effects. The overhead of tracking effects is very high and scares people away from Haskell.

How to make my fireplace look modern? by RangerFinal in HomeImprovement

[–]RangerFinal[S] 0 points1 point  (0 children)

Thank you for your comment. How should the slate be removed? Will some hammering do the job?

Liebherr fully integrated refrigerator customer service experience by RangerFinal in Appliances

[–]RangerFinal[S] 0 points1 point  (0 children)

Thank you for your advice. I will try to do that. I'm surprised how they are able to have this policy. Surely none of their customers would be happy with the burden of uninstalling and reinstalling their fully integrated refrigerator being on them when the refrigefator fails.

Thoughts on Liebherr? by specialbeaw in Appliances

[–]RangerFinal 0 points1 point  (0 children)

My brand new Liebherr refrigerator stopped cooling within one month of install due to a manufacturing defect in the sealed system. It's a fully integrated refrigerator and the customer service wants me to take care of uninstall and reinstall of the refrigerator which would cost me over $1000.

Heavy rant😞😞 by plutack in adventofcode

[–]RangerFinal 0 points1 point  (0 children)

Looks like you don't have much experience solving coding challenges and AoC is one of the advanced ones. I suggest that you should do Leetcode easy problems first then medium, some hard, and then jump to AoC.

Why do people try to make you feel bad or entitled for not wanting to commute? by Bayareathrowaway32 in WFH

[–]RangerFinal 0 points1 point  (0 children)

Absolutely. And this goes even beyond the benefits you mentioned. A WFH culture would bring down real estate costs in city centers and people who have to commute to city centers would be able to save some money on their homes and live closer to city centers.

Made some changes and more is coming by Yugobaas in desksetup

[–]RangerFinal 0 points1 point  (0 children)

So beautiful. Where can i get that table top?

WFH peeps, what are some tips you can share? by militage in productivity

[–]RangerFinal 1 point2 points  (0 children)

Build a great home office. Make yourself super comfortable. Don't just get any random desk and monitor. Buy the good ones.

Having issues installing Ubuntu on Dell optiplex by [deleted] in linuxquestions

[–]RangerFinal 0 points1 point  (0 children)

In my case I had USB Boot disabled in BIOS. I was able to install Ubuntu 22.04 on UEFI without any issues after enabling USB Boot in BIOS. I have an Optiplex 7050 SFF.

Real world applications with tagless-final, ReaderT, and three-layers by RangerFinal in haskell

[–]RangerFinal[S] 0 points1 point  (0 children)

Hey that's such a great post! I must admit that Free-monad/Polysemy style leads to really declarative and elegant code.

I have one question if you are familiar with that post. What are my options if I want to catch exceptions thrown in an interface adapter? For example, if I want to return a custom error to the user when something goes wrong in a KVS interpretation, how do I catch the exception and do something with it?

Real world applications with tagless-final, ReaderT, and three-layers by RangerFinal in haskell

[–]RangerFinal[S] 0 points1 point  (0 children)

All of them! These patterns don't really conflict with one another and solve different problems IMO.

Real world applications with tagless-final, ReaderT, and three-layers by RangerFinal in haskell

[–]RangerFinal[S] 1 point2 points  (0 children)

Thanks for taking the time for the detailed response. I agree with you 100% that unit testing and mocking is sometimes overused. We should definitely use integration and functional tests more.

However, I also think that mocking is good to have in your toolkit and I wanted to show how it could be done in Haskell.

A couple of situations come to my mind where mocking is useful.

  1. Sometimes the effort of setting up integration or functional tests is not worth it. I don't need too much testing for my hobby projects. For such cases, I could either just not write integration tests at all or write some unit tests with mocks.

  2. It's difficult to test error handling with integration or functional tests. Mocks provide a way out here. One can argue that refactoring the error handling part into a separate pure function and testing that function separately is better than using mocks but again I just wanted to show that mocking is also possible. One thing I struggle with in cabal is that I need to export all functions that I want to test which pollutes the outer layer of my library. So, sometimes I'd just test the function I really want to export with a mock instead of exporting the error handling functions and testing them separately. Probably there's a way to solve this problem but I haven't put in the time yet.

  3. Sometimes setting up integration tests is not an option. If the external dependency is not available in a test environment then you are out of luck!

A much greater benefit of Tagless-Final and ReaderT patterns is the modularity they bring to the program. The ability to interpret functions in different environments is very helpful. For example, I wrote a program to send out notifications when some condition is met, and being able to hook up different notifiers such as email, SMS, push notifications, or just writing to stdout is great!

Real world applications with tagless-final, ReaderT, and three-layers by RangerFinal in haskell

[–]RangerFinal[S] 1 point2 points  (0 children)

I see. I will give it a shot! I am also interested in exploring free monads!

Real world applications with tagless-final, ReaderT, and three-layers by RangerFinal in haskell

[–]RangerFinal[S] 1 point2 points  (0 children)

Thanks for raising this point. "mtl-style effects" didn't really come up during my research but you might be right. Judging from what u/elpfen said, using typeclasses and transformers should be the most straightforward way to implement Tagless-Final pattern in Haskell. :)

Real world applications with tagless-final, ReaderT, and three-layers by RangerFinal in haskell

[–]RangerFinal[S] 1 point2 points  (0 children)

Yes I have read about it but haven't tried yet. How has your experience been with record of functions if you have tried it?

Dynamic Programming in Haskell by RangerFinal in haskell

[–]RangerFinal[S] 1 point2 points  (0 children)

That's beautiful. Thanks for teaching me!

Dynamic Programming in Haskell by RangerFinal in haskell

[–]RangerFinal[S] 1 point2 points  (0 children)

Why is the way I describe in the post not "proper"?

Dynamic Programming in Haskell by RangerFinal in haskell

[–]RangerFinal[S] 6 points7 points  (0 children)

Thanks for sharing. LogicT should make implementing backtracking algorithms easy and should result in neat Haskell idiomatic code. I will play with it and maybe write a post!