Skip to content

Instantly share code, notes, and snippets.

View jinjor's full-sized avatar

Yosuke Torii jinjor

View GitHub Profile
@jinjor
jinjor / Lambda.elm
Last active January 22, 2017 15:01
import Html exposing (text)
main =
text (toString output)
output =
apply app
@jinjor
jinjor / StateExample.hs
Created January 16, 2017 09:34
State Monad
module Main where
import Control.Monad.State
foo :: State Int String
foo = do
count <- get
put $ count + 1
return "Hello"
@jinjor
jinjor / Oyako.elm
Last active December 7, 2016 17:27
-- MODEL ----------
type alias Id = String
-- Son
type alias Son =
{ id : Id
type alias Position
= (Align, Align)
type alias Size
= Int
type alias Length
= Int
type alias Align
@jinjor
jinjor / Child.elm
Created September 23, 2016 14:51
Nested subscriptions
-- this is serializable
type alias Input = (String, Json.Decode.Value)
-- this may be not serializable
type Msg = ...
-- Transform Input to Msg.
inputToMsg : Input -> Msg
inputToMsg (tipe, json) =
if tipe == ...
--module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Html.App exposing (..)
import Array exposing (Array)
import Html exposing (..)
import Html.App exposing (beginnerProgram)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Json.Decode as Decode exposing (..)
main =
beginnerProgram { model = "", view = view, update = update }
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (on)
import Json.Decode as Json exposing ((:=))
import Mouse exposing (Position)
main =
Html.program <| debugOn
{ init = init
import Html exposing (Attribute, div, button, text)
import Html.App exposing (beginnerProgram)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick, onMouseEnter, onMouseLeave)
import Set exposing (Set)
main =
beginnerProgram { model = { count = 0, hover = hoverInit }, view = view, update = update }
import Html exposing (Html, text, button, div, p, ul, li)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
type OuterMsg =
ContainerMsg InnerMsg | View1Click | View2Click
main : Html OuterMsg