In a type specific module, we can name succinctly
module Channel
type Channel
= Alpha
| Beta
In a type specific module, we can name succinctly
module Channel
type Channel
= Alpha
| Beta
resource "aws_iam_role" "foobar-role" { | |
name = "foobar" | |
path = "/" | |
assume_role_policy = data.aws_iam_policy_document.foobar-assume-role-policy-document.json | |
managed_policy_arns = [aws_iam_policy.foobar-policy.arn] | |
} | |
data "aws_iam_policy_document" "foobar-assume-role-policy-document" { | |
statement { | |
actions = ["sts:AssumeRole"] |
<div class="max-w-screen bg-gray-100 text-center"> | |
<span class="text-red-400 sm:hidden">xs</span> | |
<span class="text-yellow-400 hidden sm:inline md:hidden">sm</span> | |
<span class="text-green-400 hidden md:inline lg:hidden">md</span> | |
<span class="text-blue-400 hidden lg:inline xl:hidden">lg</span> | |
<span class="text-purple-400 hidden xl:inline 2xl:hidden">xl</span> | |
<span class="text-pink-400 hidden 2xl:inline 3xl:hidden">2xl</span> | |
</div> |
#!/bin/sh | |
if $(which elm) $* | |
then | |
echo '{"type":"compile-errors","errors":[]}' >&2 | |
else | |
touch $0 | |
fi |
var waitall = { | |
defer: [], | |
final: null | |
} | |
// will make sure to call `waitall.final` when all `waitall.defer` has cleared | |
function defer (fn) { | |
waitall.defer.push(fn) | |
return function (...args) { | |
var result = fn(...args) |
function camelize (str) { | |
let parts = str.replace(/_/g, ' ').toLowerCase().split(/\W+/) | |
.reduce(function (sum, s) { | |
if (typeof sum === 'string') sum = [sum] | |
if (sum[0]) return [...sum, s[0].toUpperCase() + s.slice(1)] | |
return [s] | |
}) | |
return (typeof parts === 'string' ? parts : parts.join('')) | |
} | |
console.log(`module Env exposing (..) |
Elm is a language. You write programs with it.
But instead of providing a regular main
function to run, Elm wants you to write at least 2 parts to run your program: init
and update
. This is my pseudo code for your init
and update
plugs into Elm runtime:
let [globalState, cmd] = init(optionFlags)
Scenario: Given a cookie string (which may be absent), parse and return a User record/struct
Often we'd write functions where arguments are "nullable", aka *string
in Go, aka a Maybe
in Elm
-- function `userFromCookie` with parameter type `Maybe String` return type `User`
userFromCookie1 : Maybe String -> User
userFromCookie1 maybeString =
case maybeString of
Nothing ->