haskell / play-haskell

Haskell Playground
129 stars 8 forks source link

Suggestion: Multiple Examples of Haskell Code #41

Open liamzee opened 10 months ago

liamzee commented 10 months ago

Feature request

It might present a better introduction to Haskell if there were a broader list of Haskell programs on display.

I'm the owner of this, for example:

https://www.github.com/haskript/big-book-of-small-haskell-projects

Including a ton of micro-projects that, unlike the exercise book I've been working through, show off Haskell's good side (expressive, strong types, concise code, decent, if sometimes impenetrable libraries) might be helpful for the Playground.

tomsmeding commented 10 months ago

Fair! As for the repo you've linked, though, I feel like most programs are on the long side for a playground template. The longest template program so far is 38 lines, and I don't want to make them much longer than that -- the point is to put something in there so that the "Run" button does something interesting instead of "you need to type some code first".

That HexGrid example is neat, though -- I might steal that one :)

liamzee commented 10 months ago

It's not like didn't I steal it and adapt it from Al Sweigart (with permission) anyways. :)

I also agree that the examples should be small; i.e, do something interesting, maybe grab some data from a site, do ultra-concise data transformation, etc...

tomsmeding commented 10 months ago

I added a modified version of the hexgrid example. Thanks! :)

I'll close this issue for now. If you have other suggestions of small teaser programs that could perhaps replace one of the existing ones, feel free to suggest and I'll have a look.

liamzee commented 10 months ago

I meant having multiple small examples stored in a repository; i.e, being able to choose a bunch of different programs as needed.

tomsmeding commented 10 months ago

How do you mean "as needed"? Would the playground randomly one from the repository, or would the user get to see a list of examples to choose from, or something else?

liamzee commented 10 months ago

Both, I think, having the playground choose a random example from a select list, then leave a bunch of examples available for the user to select and toy around with if they like it.

tomsmeding commented 10 months ago

Fair, perhaps that's a nice idea. They should be examples that don't try to read input from stdin though, because of how the playground is currently set up.

I'll reopen this.