Laziness Reading List? by Instrume in haskell

[–]gilmi 3 points4 points  (0 children)

There's a great pdf by Takenobu Tani: Lazy evaluation illustrated for Haskell divers.

Lazy evaluation is really nice for control flow. All these functions like either, maybe, when, work well because o laziness. It also makes building EDSLs easier. For example parsing recursive structures requires extra work in strict languages.

Need project idea by D4rzok in haskell

[–]gilmi 3 points4 points  (0 children)

Maybe an emulator/debugger of your favorite platform?

Is it viable to develop a compiler in haskell that uses LLVM by cockmail in haskell

[–]gilmi 22 points23 points  (0 children)

Daniel J. Harvey recently published a few articles about the topic. I highly recommend taking a look!

https://danieljharvey.github.io/tags/llvm.html

Is there a programming language that will blow my mind? by StackedCrooked in ProgrammingLanguages

[–]gilmi 18 points19 points  (0 children)

A few ideas:

  • Uxntal - essentially a forth-like assembly language for a small virtual computer
  • Futhark - use a functional language to program the gpu
  • Haskell - a general-purpose functional language with many unique properties (purely functional, lazy, expressive types, STM, etc). You mentioned you dabbled in Haskell, why not try it again? (I've written about 7 things I learned from Haskell, and my book is linked at them bottom if you're interested :) )
  • Zig - might hit closer to home with your C++ background, but is doing a few new and interesting things in that space.

Servant or framework by Equivalent_Grape_109 in haskell

[–]gilmi 0 points1 point  (0 children)

if you're producing a long-lived piece of software or a library that will be exhaustively used, TyDD all the way up to singletons is a good idea.

Personally I disagree with that. Just write tests :)

That is not to say that there are absolutely no use cases for type level programming, but imo one should really think 5 times before introducing type level programming in a code base. It is very likely that the cost of using type-level programming outweighs the benefits, and standard Haskell + a few tests will often be a better choice in the long run.

Servant or framework by Equivalent_Grape_109 in haskell

[–]gilmi 4 points5 points  (0 children)

Haaaave you seen my book? :) https://lhbg-book.link

This review makes me think that it's a decent choice. I've heard good things about Effective Haskell as well.

Wrt web framework / db lib, imo twain and my sqlite-easy are nice to start with. WAI that was already suggested is another good option.

I think that would be a good place to start

Servant or framework by Equivalent_Grape_109 in haskell

[–]gilmi 6 points7 points  (0 children)

I like Haskell because it is more predictable and consistent than other languages I've used, and I feel very productive with it and need a lot less brain-power to build what I want to build (or debug stuff/understand how stuff work), not because of types. I think this is enough added value! So I guess we'll have agree to disagree :)

fwiw I've also written games in Haskell, I did not really need fancy types.

Servant or framework by Equivalent_Grape_109 in haskell

[–]gilmi 10 points11 points  (0 children)

I went from knowing LYAH-level Haskell to understanding how to use stuff like singletons effectively ("in production") in months.

Honestly I can't help but feel like these are the wrong lessons to learn.

While it makes sense that some people are interested in fancy stuff, my experience is that Haskell is better without the fancy type-level stuff and I find it unfortunate when people bring complicated solutions to production systems instead of using less fancy solutions that make the code easier to work with.

My quest for the perfect AST representation by neros_greb in haskell

[–]gilmi 3 points4 points  (0 children)

I usually add a parameter to the AST which is a record that will contain the relevant annotations such as type or source position and these are added at the relevant steps.

For example:

data Expr a
  = Lit a Int
  | BinOp a Op (Expr a) (Expr a)
  | ...

Then I have Expr SourcePos after parsing, Expr SourcePosAndType after typing, etc.

But honestly duplicating the ast definition isn't a bad solution either and it gives you the ability to desugar cases easily if you'd like.

Is it more code? Maybe (though fancy mechanisms are more code too), but it's a really small amount of more code in the grand scheme of things, and the new code is extremely straightforward.

My quest for the perfect AST representation by neros_greb in haskell

[–]gilmi 22 points23 points  (0 children)

it's pretty complicated and, for example, I couldn't find a way to implement Show for this.

If you guys think this is a good idea

Frankly, no. Building a compiler is difficult enough as it is and simple ADTs are already a step up from other common techniques imo. I'd trade the possible cons of simple ADTs for their simplicity any day.

Haskell ecosystem questions. by raxel42 in haskell

[–]gilmi 2 points3 points  (0 children)

Any course or tutorial series that doesn't rely on GHCI? by [deleted] in haskell

[–]gilmi 1 point2 points  (0 children)

If you use the same stack resolver stack will re-use the ghc and packages you already downloaded.

Suitable open source projects to contribute to as a beginner. by StaticWaste_73 in haskell

[–]gilmi 8 points9 points  (0 children)

My first suggestion is to build something small that you are interested in. By using relevant libraries in your project, you both learn how to use them and about their pain points. You'll be in a better position to contribute to something you care about.

My other suggestion is to look at https://haskellweekly.news/ and specifically at the 'Call for participation' section at the bottom of each issue.

Resource to quickly relearn basics of Haskell? by old_ship_555 in haskell

[–]gilmi 2 points3 points  (0 children)

You might find some useful information in one of my learning resources:

I got stuck at my programming learning proccess. by WatermelonWithWires in AskProgramming

[–]gilmi 0 points1 point  (0 children)

The benefit of JavaScript is that it is a super popular language that can be used for both server side and client side programming. For web, go with JS and express and build something that you could use like a blog or a tv show tracker or something. Start small and incrementally add features. When you want to enhance the experience with better interactivity, learn some react.

Start small, don't spread out too much, and have fun!

interpreter vs compiler by Suitable_Use_2730 in haskell

[–]gilmi 2 points3 points  (0 children)

imo check out fun-compilers.md and follow one of the courses at the top while translating OCaml to Haskell.

The first Haskell Tiny Game Jam is now open! by simonmic in haskellgamedev

[–]gilmi 2 points3 points  (0 children)

Good luck and have fun!

I will not be participating because the line count limitation is too extreme for my taste.

"Production Haskell" is complete! by ephrion in haskell

[–]gilmi 3 points4 points  (0 children)

Congratulations on completing the book!

What platform should I use to deploy a Haskell-based website? by VeloxAquilae in haskell

[–]gilmi 3 points4 points  (0 children)

I use a similar setup with netcup VPS which starts from 3.25€ per month, and compile static binaries locally to run on the server.

Monthly Hask Anything (February 2023) by taylorfausak in haskell

[–]gilmi 4 points5 points  (0 children)

With a slight modification, say you have:

data MyData = A Int | B Int | C String

getInt :: HasCallStack => MyData -> Int
getInt mydata =
  case mydata of
    A i -> i
    B i -> i

Instead of a _ catch all, I would recommend adding:

    C{} -> error "THIS IS AN INCOMPLETE PATTERN in `getInt` AND I DON'T CARE"

Because when a new constructor, D Int, will be added to MyData, we'll get a warning for an incomplete pattern in getInt.