There's a lot of type terminology and jargon going around when discussing types in Elm. This glossary attempts to list some of the most common type terms along with synonyms, terms from other language communities, examples, and links to more detailed articles on each topic.
#!/usr/bin/env bash | |
function house_builder() { | |
# floors,rooms,has_garage | |
echo "0,0,0" | |
} | |
function set_field() { | |
local f r g | |
IFS=, read f r g |
program = [ comment ], [ "port" ], "module", module_name, "exposing", "(", exposed_list, ")", { import_statement }, { declaration }, { comment }; | |
module_name = identifier, { ".", identifier }, [ comment ]; | |
exposed_list = identifier | "(", identifier, { ",", identifier }, ")", [ comment ] | ".."; | |
import_statement = "import", module_name, [ import_alias ], [ "exposing", "(", exposed_list, ")" ], [ comment ]; | |
import_alias = "as", identifier, [ comment ]; | |
declaration = type_declaration | |
| type_alias_declaration |
// Piece.equal (a: (Piece)) (b: (Piece)) : (Bool) | |
(Piece.equal (Piece.o) (Piece.o)) = (Bool.true) | |
(Piece.equal (Piece.x) (Piece.x)) = (Bool.true) | |
(Piece.equal (Piece.o) (Piece.x)) = (Bool.false) | |
(Piece.equal (Piece.x) (Piece.o)) = (Bool.false) | |
// Piece.show (piece: (Piece)) : (String) | |
(Piece.show (Piece.o)) = "O" | |
(Piece.show (Piece.x)) = "X" |
{ pkgs }: | |
pkgs.symlinkJoin { | |
name = "elm-format-wrapper"; | |
paths = [ | |
(pkgs.writers.writeDashBin "elm-format" '' | |
# elm-format-wrapper 1.0.0 | |
# | |
# Usage: | |
# elm-format [--help] [--action=ACTION] PATH... |
#include <time.h> // Robert Nystrom | |
#include <stdio.h> // @munificentbob | |
#include <stdlib.h> // for Ginny | |
#define r return // 2008-2019 | |
#define l(a, b, c, d) for (i y=a;y\ | |
<b; y++) for (int x = c; x < d; x++) | |
typedef int i;const i H=40;const i W | |
=80;i m[40][80];i g(i x){r rand()%x; | |
}void cave(i s){i w=g(10)+5;i h=g(6) | |
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u |
Lightning Talk proposal for ReactiveConf 2017 http://www.reactiveconf.com #ReactiveConf
Elm is a statically-typed functional programming language. Its compiler produces safe JavaScript which is guaranteed to be free of runtime exceptions. Moreover Elm is packed with a bunch of powerful abstractions which let us build visual and reactive Web applications in a few lines of code.
As an example, I show the implementation of a simple framework for building Prezi-like presentations. It's just 99 lines of code!
javascript: | |
document.querySelectorAll('.load-diff-button').forEach(node => node.click()) |
- Star this gist to see the talk at ReactiveConf 2016.
- Retweet to spread the word.
- Have a look at this blog post to see other proposals.
- Try elm-search to see what this is all about.
Elm is a statically typed functional language that compiles to JavaScript. It's well-known for its developer experience: the compiler provides nice error messages, the package system enforces semantic versioning for all published packages and makes sure every exposed value or type has some documentation and type annotations.
const div = (verbed, numerator, denominator) => | |
`${numerator} ${verbed} ${denominator} is ${numerator/denominator}` | |
div('divided by', 1, 3) | |
//=> 1 divided by 3 is 0.3333333333333333 | |
const anyPartialApplication = (() => { | |
const placeholder = {}, | |
anyPartialApplication = (fn, ...template) => { | |
let remainingArgIndex = 0; |