View gist:a71dc1bfdf8c1534a046
This file contains 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
x@server:~$ cabal install lens | |
Resolving dependencies... | |
In order, the following would be installed: | |
parallel-3.2.0.4 (new package) | |
prelude-extras-0.4 (new package) | |
reflection-1.4 (new package) | |
transformers-0.3.0.0 (new version) | |
mtl-2.1.3.1 (new version) | |
aeson-0.7.0.6 (reinstall) changes: mtl-2.2.0.1 -> 2.1.3.1 | |
exceptions-0.6.1 (reinstall) changes: mtl-2.2.0.1 -> 2.1.3.1, |
View gist:69b87f6279765659cab8
This file contains 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 Doc.Core where | |
import Data.Map (Map, lookup, insert) | |
import Data.Maybe (fromJust) | |
data Doc = Doc { _tag :: Node, _order :: [Id], _childs :: Map Id Doc } | |
makeLenses ''Doc | |
doc__get_child :: Doc -> Id -> Doc |
View gist:229b2d8a0adf81c8d6c6
This file contains 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 Doc = Doc { tag :: Node, order :: [Id], childs :: Map Id Doc } | |
doc__get_child :: Doc -> Id -> Doc | |
doc__get_child doc id = fromJust (Data.Map.lookup id (childs doc)) | |
doc__set_child :: Doc -> Id -> Doc -> Doc | |
doc__set_child doc id value = doc { childs = Data.Map.insert id value (childs doc) } |
View gist:c4f4e50228b363b13397
This file contains 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 Hello where | |
import Data.Map as M | |
import FFI | |
data Tag = Tag [String] | |
data Attrs = Map String String | |
data Doc = Doc { tag :: Tag, |
View gist:b8db01ac91ee5d2805e5
This file contains 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
(Rec [x] | |
(U '{:op (Value :if) | |
:test x | |
:then x | |
:else x} | |
'{:op (Value :var) | |
:var clojure.lang.Var} | |
'{:op (Value :nil)} | |
'{:op (Value :false)})))) |
View gist:f99df246b23dbf58d374
This file contains 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
(ns doc.doc-diff | |
#+clj (:require [clojure.core.typed :as t]) | |
#+cljs (:require-macros [cljs.core.typed :as t])) | |
(t/declare-datatypes 'Set-Attrs) | |
(t/declare-names 'Set-Attrs) | |
(t/declare-datatypes Set-Attrs) | |
(t/declare-names Set-Attrs) | |
(t/defalias Cmd (U Set-Attrs Set-Order Update-Child Swap-Child)) |
View gist:90a59a65824092177947
This file contains 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
(ns cljs.core.typed | |
"Macros for Clojurescript type checking" | |
(:refer-clojure :exclude [type defprotocol #_letfn fn loop dotimes let for doseq | |
#_def #_filter #_remove]) | |
(:require [clojure.core.typed :as t] | |
[clojure.core.typed.current-impl :as impl :refer [v]] | |
[clojure.core.typed.util-cljs :as u] | |
[cljs.analyzer :as ana] | |
[cljs.compiler :as comp] | |
[cljs.core :as core] |
View gist:50ac3fbba4251436abc1
This file contains 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
(ns doc.doc-diff | |
#+clj (:require [clojure.core.typed :as t]) | |
#+cljs (:require-macros [cljs.core.typed :as t])) | |
(t/defalias Cmd (U Set-Attrs Set-Order Update-Child Swap-Child)) | |
(t/defalias Cmds (t/Seq Cmd)) | |
View gist:10002189
This file contains 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
websocket_handle({text, Msg}, Req, State) -> | |
try _X = lists:flatten(io_lib:format("~p", [erldn:parse_str(Msg)])) of | |
_ -> {reply, {text, <<"That's what she said! ", Msg/binary >>}, Req, State} | |
catch | |
_ -> {reply, {text, <<"ERROR Parsing", Msg/binary >>}, Req, State} | |
end; | |
websocket_handle(_Data, Req, State) -> | |
{ok, Req, State}. | |
View gist:9444104
This file contains 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(websocket_app). | |
-behaviour(application). | |
-export([start/2]). | |
-export([stop/1]). | |
-export([public_router/0]). | |
public_router() -> |
NewerOlder