3,337 karma · joined May 8, 2011
https://kaspar.systems
github.com/kasbah
hn@kaspar.systems ---
How would you compare it to Nearley? Can Ohm handle ambiguous grammars?
I am now watching his "Simple Made Easy" talk [1] after I have heard it recommended on a few functional programming related podcasts. Again really interesting stuff but I encountered another cheap shot at typed functional programming ("You can't use monads for that! Hurr hurr hurr").
Given how well received these talks seem to be by people that enjoy programming with advanced type systems I would have have really expected a more balanced discussion and some acknowledgement of the trade-offs between dynamic and statically typed functional programming.
I haven't thought about it enough but I am a big fan of Elm's declarative graphics [1]. I think starting with something like that would be interesting.
n1 = circle "node 1"
n2 = square "node 2" |> outlined red
main = graph [edge n1 n2, edge n2 n1]
[1]: https://csmith111.gitbooks.io/functional-reactive-programmin... Immutable({a: 1}) !== Immutable({a: 1})
There is no built in equality function either [1] so that seems like that's a big advantage Immutable.js has over this. Maybe seamless-immutable-diff [2] could be a way to do it but I am not sure on the performance.[1]: https://github.com/rtfeldman/seamless-immutable/issues/186 [2]: https://www.npmjs.com/package/seamless-immutable-diff
The benchmarks in the Timm readme are interesting though. I would like to see a benchmark of seamless-immutable in production mode added to compare.
I wondered if you might have something to say on performance issues. You didn't encounter anything of that sort?
- I don't like the `@kea(...` because it's another bit of JS syntax I hadn't heard of before. Though I do like decorators in Python, I just feel like I have learned enough of JS syntax to be productive and they seem to keep adding unnecessary stuff.
- There is still duplication between the action names and the reducers. When using Redux I now always use these two functions:
function makeReducer(reducerObject) {
return (state, action) => {
if (Object.keys(reducerObject).includes(action.type)) {
return reducerObject[action.type](state, action.value)
}
return state
}
}
function makeActions(reducerObject) {
const actions = {}
Object.keys(reducerObject).forEach(name => {
actions[name] = value => {
return {type: name, value}
}
})
return actions
}
So I can just declare a single object of reducers and can infer the action names and creators from that e.g. const reducerObject = {
increment(state, value) {
return state + 1
},
decrement(state, value) {
return state - 1
}
}
const reducer = makeReducer(reducerObject)
const actions = makeActions(reducerObject) 0[~/.../a/folder]$ false
1[~/.../a/folder]$
In my .bashrc: PROMPT_DIRTRIM=2
PS1='\[\e]2;[\W]\$\a\]$(printf "%d" $?)[\w]\$ 'I actually much prefer the Piwik interface, I don't need to dig through masses of menu options to find the data I actually care about. Not helping the Google panopticon is a bonus.
I don't think that's required. Superagent already returns promises.