CompilerBlob

Functions for working with the Haskell-based Gren compiler.

version : String

Version of the compiler blob. This might not match the version of the Gren compiler as a whole, as the Haskell- and Gren-parts are versioned seperatly.

type UnsupportedPlatform
= UnsupportedPlatform

Type used to signal that the given platform isn't supported. Meaning that there doesn't exist a pre-built compiler blob.

downloadUrl :
Platform
-> CpuArchitecture
-> Result UnsupportedPlatform String

Construct a URL from which you can download a compiler blob compatible with the given platform and cpu architecture.

download : Permission -> String -> Task (Error Bytes) (Response Bytes)

Downlod the compiler blob.

cachePath : Platform -> Dict String String -> Path -> Path

Construct a Path where we'd expect to find the compiler blob if it has been downloaded previously.

isCached :
Permission
-> Platform
-> Dict String String
-> Path
-> Task x Bool

Checks if the compiler blob exist on this system.

type Command
= Init InitFlags
| Repl ReplFlags
| Make MakeFlags (Array Path)
| Docs DocsFlags
| PackageInstall (Maybe Package)
| PackageUninstall Package
| PackageOutdated
| PackageValidate
| PackageBump
| PackageDiff DiffArgs

Commands supported by the compiler blob.

  • Init: generate a gren.json and src directory in the current directory.
  • Repl: run a REPL.
  • Make: compile a project
  • Docs: generate a docs.json file
  • PackageInstall: install dependencies
  • PackageUninstall: remove a dependency
  • PackageOutdated: get a list of outdated dependencies
  • PackageValide: check if this package is ready to be deployed
  • PackageBump: bump package version to next compatible semantic version
  • PackageDiff: calculate the API-difference between this package and another version.
type alias InitFlags = { package : Bool, platform : Platform }
type alias ReplFlags = { interpreter : Maybe String }
type alias MakeFlags =
{ optimize : Bool
, sourcemaps : Bool
, output : Maybe MakeOutput
, report : Maybe {}
}
type MakeOutput
= StdOut
| DevNull
| Html String
| Js String
| Exe String
type alias DocsFlags = { output : Maybe DocsOutput, report : Maybe {} }
type DocsOutput
= DocsStdOut
| DocsDevNull
| DocsJson String
type DiffArgs
= DiffLatest
| DiffVersion SemanticVersion
| DiffRange SemanticVersion SemanticVersion
| DiffGlobal Package SemanticVersion SemanticVersion
type Platform
= Common
| Browser
| Node
run : Permission -> RunOptions msg -> Cmd msg

Execute the compiler blob. The blob will write to stdout and stderr. There's currently no way to redirect what is written to these streams.