Conversation
No, that’s not needed.
I wasn’t envisioning this in the editor-and-compile-view, at least not originally. My idea was to use this feature in the post-to-API-to-get-a-display-without-code. About the configurable hole-filling: does this also allow for „undefined :: Double -> Picture“? (which could be replaced by „const blank“) |
The regular expression should not cover that currently. I'll try to update it. |
|
Function holes are now supported as well. Config would then look like this: preview:
defaultHoleValues:
"Double -> Picture": "const blank"
"Double": "0" |
|
Wie robust ist das gegen Vorkommen von „undefined“ im Programmtext, die gar nicht für Prelude.undefined stehen, sondern etwa „let undefinedNumber = 42 in whatever“ oder einen String, der „undefined“ enthält? Sollte vielleicht zumindest gecheckt werden, dass der GHC genau so viele typed holes meldet, wie man vorher „undefined“ durch „_“ ersetzt hat? |
| then pure (status, res) | ||
| else do | ||
| let sourceWithHoles = T.replace "undefined" "_" source | ||
| (status',res') <- liftIO $ runCompile ctx programId mode sourceWithHoles |
There was a problem hiding this comment.
Das heißt, ein weiterer Compile wird selbst dann durchgeführt, wenn überhaupt keine Ersetzungen vorgenommen wurden (weil keine undefineds vorkamen)?
Das sollte sicher optimiert werden.
|
Anschließend: fmidue/haskell-template-task#40 |
This pull request implements previews that allow us to show preview images of incomplete programs.
Example:
will produce this image:

The feature can be enabled per-request by adding a
enablePreviewfield to the/compilerequest that has valuetrue. It can also be enabled by default via a config setting. The field value in the request will then override the default.The config path can be set via the
CONFIG_PATHenvironment variable. The content of theconfig.yamlwould then look like this:(My further goal is to replace the
extensions.yamlconfig file by a field in this new consolidated config.)A few questions left: