If you use Ellie for quick non-interactive experiments like I do when playing with different language features or trying out API ideas, you probably find yourself either deleting the default code that a new Ellie is populated with, or somewhat awkwardly adding bits to it.
Update: Bill St. Clair showed me a much shorter boilerlate:
module Main exposing (main)
import Html exposing (text)
main =
text "hello"
That’s it! main
doesn’t have to be a Program
value - it can be an Html
value too.
Here is a link to the Ellie with this code: https://ellie-app.com/3yWZqvt8RYTa1.
Original boilerplate below.
I kept doing that for a while, and finally I decided to document a minimal boilerplate for static content:
module Main exposing (main)
import Browser
import Html exposing (text)
main : Program () () Never
main =
Browser.sandbox { init = (), view = \_ -> text makeStr, update = \_ _ -> () }
makeStr : String
makeStr =
Debug.toString [ 1 ]
Since it’s only a few lines, it’s easy to add your own code. To produce output, just modify the makeStr
value.
And here is a link to an actual Ellie with this code: https://ellie-app.com/3yhWdFr38z5a1