Skip to content

Instantly share code, notes, and snippets.

Simon Hampton simonh1000

Block or report user

Report or block simonh1000

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@simonh1000
simonh1000 / River.elm
Created Feb 14, 2018
Wolf, Goat, Cabbage problem in Elm
View River.elm
module River exposing (..)
type Character
= Wolf
| Goat
| Cabbage
type State
@simonh1000
simonh1000 / Example2.elm
Created Nov 26, 2016
Elm Navigation with HTML5 links
View Example2.elm
module Main exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Navigation
import Json.Decode as Json
main =
@simonh1000
simonh1000 / DragTable.elm
Last active Jun 29, 2017
Draggable table
View DragTable.elm
module DragTable exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Json.Decode as Json exposing (Decoder, Value)
import Dict exposing (Dict)
import List as L exposing (drop, take)
import Tuple
View Test.elm
module Test exposing (..)
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import List exposing (map)
import Json.Decode as Json
View Main.elm
module Test exposing (..)
import Platform.Cmd exposing (Cmd)
import Html exposing (..)
import Html.App as Html
import Html.Attributes exposing (..)
import Form exposing (..)
import Form.Input as Input
@simonh1000
simonh1000 / Main.elm
Last active Oct 14, 2015
Elm 'SPA' with Google Maps on second page
View Main.elm
module Spa where
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import StartApp
import Effects exposing (Effects, Never)
import Task
@simonh1000
simonh1000 / ArchictectureErrorHandler.elm
Created Sep 23, 2015
Elm architecture example with Http (Json parsing) error handling
View ArchictectureErrorHandler.elm
module ArchictectureErrorHandler where
import Text exposing (fromString)
import String
import Json.Decode as Json exposing (..)
import StartApp exposing (start)
import Html exposing (..)
import Http exposing (get, Error)
import Effects exposing (Effects)
@simonh1000
simonh1000 / main.elm
Created Sep 22, 2015
Elm: Download Json with error handling
View main.elm
import Http
import Markdown
import Html exposing (Html, div, text)
import Task exposing (Task, andThen)
import Json.Decode as Json exposing (..)
type alias ValWithErr = Result String Int
main : Signal Html
main =
@simonh1000
simonh1000 / functor-monad.hs
Last active Aug 29, 2015
Functor < Applicative < Monad - demonstration of the hierarchy of type Classes
View functor-monad.hs
import Control.Applicative
import Control.Monad
-- :k MonadClass :: * -> *
data MonadClass a = MonadClass a
-- fmap :: (a -> b) -> (m a -> m b)
instance Functor MonadClass where
fmap f = (<*>) (MonadClass f)
@simonh1000
simonh1000 / Maybe.class.js
Created Jan 4, 2015
Maybe Monad in Javascript
View Maybe.class.js
"use strict"
/*
An implementation of the Maybe monad in ES6, representing
- Maybe as a singleton array
- Nothing and null
Compiled and run with Traceur
traceur --out build.js --script maybe.js
You can’t perform that action at this time.