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 MyMaybe a = | |
MyNothing | |
| MyJust a | |
deriving (Show) | |
instance Functor MyMaybe where | |
fmap _ MyNothing = MyNothing | |
fmap f (MyJust a) = MyJust (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
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
import System.Environment | |
import GHC.Generics | |
import Data.Aeson | |
import Data.Text (Text) | |
import Data.List (intersperse) |
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 CustomStartApp (start, App, Config) where | |
import Html exposing (Html) | |
import Effects exposing (Effects, Never) | |
import Task | |
type alias Config model action portAction = | |
{ init : ( model, Effects action, portAction ) | |
, update : action -> model -> ( model, Effects action, Maybe portAction ) |
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
{ | |
"version": "1.0.0", | |
"summary": "helpful summary of your project, less than 80 characters", | |
"repository": "https://github.com/user/project.git", | |
"license": "BSD3", | |
"source-directories": [ | |
"." | |
], | |
"exposed-modules": [], | |
"dependencies": { |
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 (text, div) | |
import String exposing (padLeft) | |
-- You can paste this code into http://elm-lang.org/try to have it evaluated | |
gen0WildTypeFemales = 2000000000.0 | |
gen0WildTypeMales = 2000000000.0 | |
gen0MutantFemals = 100.0 | |
gen0MutantMales = 100.0 | |
femaleMatingSuccessFactor = 0.2 |
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 (div, button, text) | |
import Html.Events exposing (onClick) | |
import Signal exposing (Mailbox, mailbox, send) | |
import StartApp.Simple as StartApp | |
main = | |
StartApp.start { model = model, view = view, update = update } | |
model = "hi" |
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 PortsExample where | |
import Html exposing (div, button, text) | |
import Html.Events exposing (onClick) | |
import Signal exposing (Mailbox, mailbox, send) | |
import StartApp | |
import Effects | |
type alias Model = 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
module CustomStartApp where | |
import Debug | |
import Html exposing (Html) | |
import Signal exposing (Address) | |
import Automaton exposing ((>>>)) | |
type alias Config model action = | |
{ model : model | |
, view : Address action -> model -> 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
type PortAction | |
= StartAudioPlayback AudioPlaybackMessage | |
| StopAudioPlayback | |
| DecodeAudioData AudioRawDataMessage | |
| NoopPortAction | |
update : Action -> Model -> (Model, Effects Action, PortAction) | |
app : App Model MainActions.PortAction | |
app = |
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
// This doesn't work, it's just a draft while thinking how best to model collections of non-trivial objects | |
const model = (function () { | |
const mediaAsset$ = createStream(droppedFiles$.filter(droppedFile => droppedFile.type.match('image.*')) | |
.map (droppedfile => { | |
const reader = new FileReader(); | |
const asset = { | |
id = cuid(), | |
name = droppedfile.name, | |
imageLoadSucceeded$ = Rx.Observable.fromEvent(reader.onload).map(_ => reader.result), |