Skip to content

Instantly share code, notes, and snippets.

Elm 0.15.1 vs 0.16 on Chrome

Result of running these benchmarks on Chrome 45.0.2454.101

These numbers seem to be pretty consistent on Blink-based browsers (Chrome and Opera) but are more like 20% to 50% improvements on FireFox, Safari, and IE. I am not sure how to explain that, so take these numbers more as an indicator of “Elm is generating faster code across the board” as opposed to “Elm is 10x faster!”

business logic from examples

@evancz
evancz / Workflow.elm
Last active January 4, 2016 09:29
How one might implement a Workflow (Monad) library in some future version of Elm.
module Workflow where
import List
import Maybe as M
import Either as E
type Workflow container =
{ return : forall a. a -> container a
, bind : forall a. container a -> (a -> container b) -> container b
}
@evancz
evancz / NameEntry.elm
Created October 25, 2013 15:41
Examples of markdown interpolation in Elm's markdown branch: https://github.com/evancz/Elm/tree/markdown
import Graphics.Input as Input
import String
main = lift2 scene textBox name
(textBox, name) = Input.field "What is your name?"
scene textBox name = [markdown|
{{ textBox }}
@evancz
evancz / Evaluator.hs
Last active December 25, 2015 02:59
How to evaluate a simple lambda calculus with a call-by-value semantics: http://www.seas.harvard.edu/courses/cs152/2013sp/lectures/lec07.pdf
data Expr
= Literal Int
| Lambda String Expr
| Apply Expr Expr
| Var String
| Sum Expr Expr
deriving Show
eval :: Expr -> Expr
eval expr =
module IntSet (empty,singleton,insert) where
data IntSet = Empty | Node Int IntSet IntSet
empty : IntSet
empty = Empty
singleton : Int -> IntSet
singleton x = Node x Empty Empty
@evancz
evancz / Mario.elm
Last active December 17, 2015 08:39
Embedding an Elm module in HTML. Warning, this is using a pre-release version of Elm 0.8, so the API may change!!!
module Mario where
import Keyboard
import Mouse
import Window
-- MODEL
mario = { x=0, y=0, vx=0, vy=0, dir="right" }
@evancz
evancz / History.elm
Last active November 23, 2015 20:44
module History where
type History state value =
{ state | undo : History s a -> Maybe (History s a)
, redo : History s a -> Maybe (History s a)
, add : a -> History s a -> History s a
, value : History s a -> Maybe a
}
type Infinite a = { past : [a], future : [a] }
@evancz
evancz / Floatify.elm
Created November 11, 2014 04:10
Trying out different ways to avoid toFloat conversions, based on this discussion (https://groups.google.com/forum/#!topic/elm-discuss/YPA2ww2P9PU)
import Window
import Color
floatify : (Int,Int) -> (Float,Float)
floatify (x,y) =
(toFloat x, toFloat y)
scene (w,h) =
flow down
[ container (floor w) (floor (h / 2)) middle (asText "blue")
@evancz
evancz / hackathon_elm-html.md
Last active August 29, 2015 14:07
Some helpful guidance, links, and examples to make this hackathon more fun and productive.

Elm Hackathon 1

Theme: exploring and using elm-html

I want us to make some cool stuff together. First, I think it will be fun, but I think we may begin to learn interesting ways to improve and extend elm-html so that we can all be more productive.

@evancz
evancz / Command Line Refresh.md
Last active August 29, 2015 14:04
A proposal for how to make all of the command line tools nicer.

Command Line Refresh for Elm

With the upcoming improvements to elm-server and elm-get, it is becoming clear that the names of the various command line tools do not actually match what they do. This is a proposal of how to sort this out.

Proposal

I propose that the typical workflow will include the following tools:

  • elm-repl - exactly the same as before
  • elm-reactor - combination of elm-server and the debugger