This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Mario where | |
import Keyboard | |
import Mouse | |
import Window | |
-- MODEL | |
mario = { x=0, y=0, vx=0, vy=0, dir="right" } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Expr | |
= Literal Int | |
| Lambda String Expr | |
| Apply Expr Expr | |
| Var String | |
| Sum Expr Expr | |
deriving Show | |
eval :: Expr -> Expr | |
eval expr = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Embedding Elm in HTML!</title> | |
<script type="text/javascript" src="elm.js"></script> | |
</head> | |
<body> | |
<h1>Stamper</h1> | |
<div id="stamper" style="width:50%; height:400px;"></div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// initialize the Shanghai component which keeps track of | |
// shipping data in and out of the Port of Shanghai. | |
var shanghai = Elm.worker(Elm.Shanghai, { | |
coordinates:[0,0], | |
incomingShip: { name:"", capacity:0 }, | |
outgoingShip: "" | |
}); | |
function logger(x) { console.log(x) } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Animal where | |
data Either a b = Left a | Right b | |
-- Left 42 <=> { "tag":"Left", "contents":[42] } | |
-- Right "cat" <=> { "tag":"Right", "contents":["cat"] } | |
port animal : Signal (Either Int String) | |
port animal = always (Right "cat") <~ every second |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Char (isDigit) | |
import String (all) | |
import Graphics.Input (Input, input, FieldContent, noContent, field) | |
main : Signal Element | |
main = scene <~ content.signal | |
content : Input FieldContent | |
content = input noContent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Graphics.Input as Input | |
main : Signal Element | |
main = lift display check.signal | |
check : Input.Input Bool | |
check = Input.input True | |
display : Bool -> Element | |
display checked = |
OlderNewer