Skip to content

fromEnv: accept a record type instead of a row type #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

nsaunders
Copy link
Owner

With this change, fromEnv will accept the desired record type instead of a row type. I'm thinking this should simplify client code most of the time. For example:

Before

type ConfigRep =
  ( "FOO" :: String
  , "BAR" :: Int
  )

type Config = { | ConfigRep }

config :: Object String -> Either (List EnvError) Config
config = fromEnv (Proxy :: _ ConfigRep)

After

type Config =
  { "FOO" :: String
  , "BAR" :: Int
  }

config :: Object String -> Either (List EnvError) Config
config = fromEnv (Proxy :: _ Config)

@nsaunders nsaunders merged commit 2f474af into master Feb 10, 2023
@nsaunders nsaunders added enhancement New feature or request breaking Breaking API change labels Feb 10, 2023
@nsaunders nsaunders deleted the proxy-record branch February 10, 2023 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking API change enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant