Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
{- This is what the runtime passes in -}
type alias UnsafeFlags =
{ browser : Maybe String
, version : Maybe String
, randomSeed : Int
}
{- And this is what we want to work with -}
type alias Flags =
{ browser : String
, version : String
, randomSeed : Int
}
sanitizeFlags : UnsafeFlags -> Flags
sanitizeFlags unsafeFlags =
{ unsafeFlags
| browser = Maybe.withDefault "unknown" unsafeFlags.browser
, version = Maybe.withDefault "unknown" unsafeFlags.version
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment