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) | |
import Html exposing (Html, div, button, text, span) | |
import Html.Events exposing (onClick) | |
type alias Init options state effect = options -> (state, List effect) | |
type alias Update action state effect = action -> state -> (state, List effect) | |
type alias View state view = state -> view | |
type alias Component options action state effect view = |
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) | |
import Html exposing (Html, div, button, span, text) | |
import Html.Events exposing (onClick) | |
type alias Component action state effect view | |
= Maybe action -> state -> (state, view, List effect) | |
type alias HtmlComponent action state effect |
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) | |
import Html exposing (Html, div, button, span, text) | |
import Html.Events exposing (onClick) | |
type alias Component action state effect view | |
= action | |
-> state | |
-> (state, List effect, view) | |
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) | |
import Html exposing (Html, div, ul, li) | |
type alias Component action state effect view | |
= state | |
-> (action -> (state, List effect), view) | |
type alias HtmlComponent action state effect | |
= Component action state effect (Address action -> Html) |
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) | |
import Html exposing (Html, div, span, button, text) | |
import Html.Events exposing (onClick) | |
import Time | |
type alias Component action state effect view = | |
state -> (action -> (state, List effect), view) | |
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 Function a b = a -> b | |
const : b -> Function a b | |
const b _ = b | |
compose : Function a b -> Function b c -> Function a c | |
compose = | |
(>>) |
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 Task exposing (Task) | |
type Never = Never Never | |
type Behavior a = Behavior (a -> Task Never (Behavior a)) | |
contramap : (b -> a) -> Behavior a -> Behavior b | |
contramap f (Behavior g) = | |
Behavior (\b -> Task.map (contramap f) (g (f 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
import Task exposing (Task) | |
type Never = Never Never | |
------------- | |
-- ADDRESS -- | |
------------- | |
type alias Address a = a -> Task Never () | |
-- An empty address that discards its input |
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 Reducer input state = input -> state -> state | |
dimapR : (a -> b) -> (b -> a) -> Reducer x a -> Reducer x b | |
dimapR f g reducer x b = | |
f (reducer x (g b)) | |
contramap : (b -> a) -> Transducer a b r | |
contramap f reducer b = | |
reducer (f 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
import Task exposing (Task, succeed) | |
type Never = Never Never | |
type alias Address e = e -> Task Never () | |
forwardTo : Address a -> (b -> a) -> Address b | |
forwardTo address f b = | |
address (f b) | |