Skip to content

Instantly share code, notes, and snippets.

View aratama's full-sized avatar
🌴
On vacation

aratama

🌴
On vacation
View GitHub Profile
@aratama
aratama / Main.purs
Created September 2, 2020 15:54
reflectSymbol
module Main where
import Prelude
import Effect (Effect)
import Data.Foldable (fold)
import TryPureScript (p, text, render)
import Data.Symbol (SProxy(..), reflectSymbol)
type T = SProxy "1"
@aratama
aratama / package.json
Created July 7, 2019 06:59
xink:startfighter package.json
{
"name": "xink",
"version": "0.1.0",
"description": "WIP",
"main": "index.js",
"directories": {
"test": "tests"
},
"scripts": {
"clean": "rimraf ./docs ./public",
@aratama
aratama / aurorscript.js
Created March 26, 2019 15:21
aurorscript.js
"use strict";
// -- stdlib --
var pure = a=>_=>a // pure :: a -> IO a
var bind = m=>f=>_=>f(m())() // bind :: IO a -> (a -> IO b) -> IO b
var exec = m=>m() // exec :: IO a -> a
var wrap = f=>a=>_=>f(a) // wrap :: (a -> b) -> (a -> IO b)
var put = wrap(console.log.bind(console)) // put :: a -> IO ()
var get = wrap(url=>{ // get :: string -> IO string
var xhr = new XMLHttpRequest()
@aratama
aratama / Main.purs
Created January 27, 2019 02:56
Fibonacchi number with ST Monad
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (logShow)
import Control.Monad.ST (run, for)
import Data.Array.ST.Partial (peek)
import Data.Array.ST (thaw, push)
import Partial.Unsafe (unsafePartial)
@aratama
aratama / Main.elm
Last active September 9, 2018 05:34
Elm 0.19 SPA Routing Paractice Swing :)
module Main exposing (Model, Msg(..), init, main, update, view)
import Browser exposing (UrlRequest(..))
import Browser.Navigation exposing (Key, load, pushUrl)
import Html exposing (Html, a, div, h1, img, p, text)
import Html.Attributes exposing (href, src)
import Url as Url exposing (Url)
import Url.Parser exposing (Parser, map, oneOf, parse, s, top)
@aratama
aratama / Main.js
Last active July 15, 2018 23:06
RowToList Excercise: Promise.props
exports.objectToArray = function(xs){
return Object.keys(xs).sort().map(function(key){
debugger
return xs[key]
})
}
exports.arrayToObject = function(xs){
return function(values){
const row = {}
@aratama
aratama / Main.purs
Created April 24, 2017 04:42
purescript-hyper example with do notation
module Main where
import Control.IxMonad (ibind, (:>>=))
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE)
import Data.MediaType.Common (textPlain)
import Hyper.Node.Server (defaultOptionsWithLogging, runServer)
import Hyper.Response (closeHeaders, contentType, end, send, toResponse, writeStatus)
import Hyper.Status (statusOK)
import Node.HTTP (HTTP)
@aratama
aratama / Main.purs
Created January 21, 2017 14:30
Mealy Machine experiments
module Main where
import Control.Applicative (class Applicative, pure)
import Control.Bind (bind)
import Control.Category (id)
import Control.Monad (class Monad)
import Control.Monad.Aff (Aff, forkAff, later', makeAff, runAff)
import Control.Monad.Aff.Console (CONSOLE, log, logShow)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Class (liftEff)
@aratama
aratama / Main.purs
Created December 13, 2016 09:24
Type level boolean values
module Main where
import Prelude (Unit)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Data.Symbol (SProxy(SProxy), reflectSymbol)
data True
data False
@aratama
aratama / Main.purs
Created December 13, 2016 09:22
Type level natural numbers
module Main where
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, logShow)
import Data.Function (const)
import Prelude (Unit, (+))
import Type.Proxy (Proxy(..))
data Zero
data Succ a