Dendritic Nix - Community-driven Nix distribution based on the Dendritic pattern.
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 40 lines 664 B view raw
1port module Ports exposing (..) 2 3import Json.Decode as D 4import Json.Encode as E 5 6 7port cmdOut : E.Value -> Cmd msg 8 9 10port cmdIn : (D.Value -> msg) -> Sub msg 11 12 13cmdEncode : String -> E.Value -> E.Value 14cmdEncode name val = 15 E.object [ ( "name", E.string name ), ( "value", val ) ] 16 17 18repoUpdate : String 19repoUpdate = 20 "REPO_UPDATE" 21 22 23clearAll : String 24clearAll = 25 "CLEAR_ALL" 26 27 28highlight : String 29highlight = 30 "HIGHLIGHT" 31 32 33isCmd : String -> D.Value -> Bool 34isCmd name json = 35 D.decodeValue (D.field "name" D.string) json == Ok name 36 37 38cmdVal : D.Decoder a -> D.Value -> Result D.Error a 39cmdVal dec json = 40 D.decodeValue (D.field "value" dec) json