LightAndLight / ipso

A functional scripting language.
https://ipso.dev
17 stars 1 forks source link

`env.getvar!` #285

Closed LightAndLight closed 1 year ago

LightAndLight commented 1 year ago

Depends on https://github.com/LightAndLight/ipso/issues/286.

env.getvar! : String -> IO String

env.getvar! is a version of env.getvar that crashes when the variable is missing. See https://github.com/LightAndLight/ipso/discussions/276 for discussion.

It should behave like this:

getvar! : String -> IO String
getvar! key =
  bind mValue <- env.getvar key
  case mValue of
    None () ->
      comp
        eprintln "missing environment variable: $key"
        exit.failure
    Some value ->
      io.pure value

To do