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 Color exposing (Color) | |
import Graphics.Collage exposing (collage, circle, move, filled) | |
import Graphics.Element exposing (Element, show) | |
import Signal exposing (Signal) | |
import Time | |
type alias Wave = | |
{ center : { x : Float, y : Float } | |
, radius : Float | |
, color : Color |
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 Signal exposing (Address, Mailbox, Signal, forwardTo) | |
import Html exposing (Html, div, ul, li) | |
import List | |
update : ID -> (state -> state) -> ContainerState state -> ContainerState state | |
update id f list = | |
case list of | |
[] -> [] | |
(id', x) :: xs -> | |
if id == id' |
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
type alias Component state action view | |
= { initial : (state, action) | |
, view : Address action -> state -> view | |
, address : Address action | |
, history : Signal (List (state, action)) | |
} | |
makeComponent | |
: state |
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 Html exposing (Html, button, text) | |
import Html.Attributes exposing (style) | |
import Html.Events exposing (..) | |
import Signal exposing (Signal, Mailbox, Address, mailbox, send) | |
import Task exposing (Task, andThen, succeed, spawn, ThreadID) | |
import Graphics.Element exposing (show) |
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
---------------------------- | |
-- Basic Audio Operations -- | |
---------------------------- | |
getAudio : String -> Task Http.Error Audio | |
play : Audio -> Task error () | |
stop : Audio -> Task error () |
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 Lazy.List where | |
import Trampoline exposing (Trampoline(..), trampoline) | |
import Array exposing (Array) | |
import List | |
type LazyListView a | |
= Nil | |
| Cons a (LazyList a) |
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
property : String -> (a -> Bool) -> Arbitrary a -> Property | |
property name predicate arbitrary n seed = | |
let | |
-- failingTestCase' : Seed -> Int -> Trampoline (Result (a, Seed, Int) Int) | |
failingTestCase' seed accum = | |
if accum >= n | |
then | |
Done (Ok n) | |
else | |
let |
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
/* | |
kill : ThreadID -> Task x () | |
*/ | |
function kill(id){ | |
return asyncFunction(function(callback){ | |
window.clearTimeout(id); | |
callback(succeed(Utils.Tuple0)); | |
}); | |
}; |
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
optional : List (Task error value) -> Task error (List value) | |
optional list = case list of | |
[] -> succeed [] | |
task :: tasks -> task | |
`andThen` (\value -> Task.map ((::) value) (optional tasks)) | |
`onError` (\_ -> optional tasks) |
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
parallel : Address a -> List (Task error a) -> Task error (List ThreadID) | |
parallel address tasks = | |
let | |
sendToAddress task = spawn (task `andThen` send address) | |
in | |
sequence (List.map sendToAddress tasks) |