play-haskell icon indicating copy to clipboard operation
play-haskell copied to clipboard

Suggestion: Multiple Examples of Haskell Code

Open liamzee opened this issue 1 year ago • 11 comments

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.

liamzee avatar Dec 18 '23 20:12 liamzee

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 :)

tomsmeding avatar Dec 18 '23 22:12 tomsmeding

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...

liamzee avatar Dec 19 '23 15:12 liamzee

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.

tomsmeding avatar Dec 20 '23 17:12 tomsmeding

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

liamzee avatar Dec 22 '23 09:12 liamzee

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?

tomsmeding avatar Dec 22 '23 09:12 tomsmeding

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.

liamzee avatar Dec 23 '23 11:12 liamzee

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.

tomsmeding avatar Dec 23 '23 11:12 tomsmeding