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 Immutable from 'immutable'; | |
/* Selection List Data Structure */ | |
class SelectionList { | |
constructor(list) { | |
if (list.length > 0) { | |
this._previous = new Immutable.Stack(); | |
this._selected = list[0]; | |
this._next = new Immutable.Stack(list.splice(1)); |
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 Definition = { | |
* kind: String, | |
* name: String, | |
* properties: [Property] | |
* } | |
* | |
* type Property = { | |
* key: String, | |
* value: [String] |
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) | |
import Signal exposing (Address) | |
type alias Init options state effect | |
= options -> (state, List effect) | |
type alias Update action state effect | |
= action -> state -> (state, List effect) | |
type alias View action 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
type alias Transition state effect = (state, List effect) | |
pipe : List a -> (a -> state -> Transition state effect) -> state -> Transition state effect | |
pipe actions update state = | |
case actions of | |
[] -> | |
(state, []) | |
x :: xs -> |
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, Attribute, ul, li, div) | |
import Html.Attributes | |
import Html.Events exposing (on) | |
import Json.Decode exposing (Decoder, (:=), at, float) | |
import List | |
import Signal exposing (Address, message) | |
import Array exposing (Array) | |
---------------------------------------------------------- |
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 Automaton a b = Automaton (a -> (b, Automaton a b)) | |
arr : (a -> b) -> Automaton a b | |
arr f = | |
Automaton (\a -> (f a, arr f)) | |
(>>>) : Automaton a b -> Automaton b c -> Automaton a c | |
(>>>) (Automaton f) (Automaton g) = | |
Automaton <| | |
\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
type Process a b | |
= Put b (Process a b) | |
| Get (a -> Process a b) | |
put : b -> Process a b -> Process a b | |
put = | |
Put | |
get : (a -> Process a b) -> Process a 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
type alias Parser s a b = | |
{ static : StaticParser s | |
, dynamic : DynamicParser s a b | |
} | |
type alias StaticParser s = | |
{ flag : Bool | |
, startingChars : List s | |
} | |
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 Continuation a r = (a -> r) -> r | |
andThen : Continuation a r -> (a -> Continuation b r) -> Continuation b r | |
andThen cont f br = | |
cont (flip f br) | |
constant : a -> Continuation a r | |
constant a f = f 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
powerset : List a -> List (List a) | |
powerset = | |
List.foldr (\x acc -> acc ++ List.map ((::) x) acc) [[]] |