google / google/codeworld

Prelude replacement by hash

Open
#1,245 1 comment 0 reactions 0 assignees View on GitHub
discussion
Dominant language
Haskell
Stars
1.3k
Forks
201
PR merge metrics
No merged PRs in 30d

Description

Documenting an idea that came up in discussion with @alphalambda.

In some cases, one wants to give students a different prelude: either to add more primitives, to restrict them, or some combination of those. For these cases, it would be interesting to let teachers implement their own custom prelude within CodeWorld itself. Then there'd be an option to `/compile` on the CodeWorld server that specifies a hash for the custom prelude. This would work similar to import-by-hash, except that the specified hash would be renamed to Prelude. The custom Prelude itself would be implemented with `PackageImports`. I've tested, and GHC will prefer a module named Prelude defined on the command line for the implicit prelude, while still allowing that module to import a Prelude explicitly from the package database.

The UI is a bit tricky. The original idea was to make this part of a UI for more guided activities that implement custom clients for the `/compile` API endpoint. That wouldn't be hard to support. But to select such a custom prelude in the main CodeWorld editor would need some extra UI complexity.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.