biscarch
Joined 14 years ago
Joined 14 years ago
add x y = x + y
it's sugar for multiple single-argument functions. add = \x -> \y -> x + y
When examining it this way, the `g` function above would translate to g = \(x, y) -> 2 * x + y
Which is a function taking a single tuple argument. It is still "default curried" but the argument being passed in is a single argument rather than multiple so we don't expand it to multiple single-arg functions. Perhaps it is more illustrative to show the definition as the single argument it is rather than using haskell's destructuring to pull x and y out of the tuple. g tuple = 2 * (fst tuple) + (snd tuple)
and a ghci session for completeness: Prelude> let g (x, y) = 2 * x + y
Prelude> g (1,2)
4
Prelude> let y tuple = 2 * (fst tuple) + (snd tuple)
Prelude> y (1,2)
4
So when we say that Haskell functions are "curried by default", what we're referring to is roughly the underlying single-argument nature of haskell functions.Your `add2` uses a tuple instead of currying whereas `add1` is already curried. In ghci:
Prelude> (+) 3 4 == (+ 3) 4
True
So you could have an `add3` just by applying 3 as the first argument. Prelude> let add3 = (+ 3)
Prelude> add3 5
8
hoogle describes uncurry as a function on pairs. https://www.haskell.org/hoogle/?hoogle=uncurry> uncurry converts a curried function to a function on pairs.
The "states" aren't related to container/dumb components or data-fetching/selection logic. They're purely about rendering the state for a given segment of the page. Perhaps this article[0] might help convey my intent. It's more about how to render "we didn't get data from that one endpoint for this section of the page" or "we're waiting for the data to show up", etc.
[0]: https://medium.com/swlh/the-nine-states-of-design-5bfe9b3d6d...
<ConditionalSpinner renderIf={data}><PersonRenderer person={data.person} /></ConditionalSpinner>
Could be written better as: <PersonRenderer person={data.person} />
Where PersonRenderer would be defined as such: class PersonRenderer extends Component {
render() {
if(this.props.person) {
return <div>personcontent</div>
}
return <LoadingIndicator/>
}
}
Given this, I'm still not sure how an If "component" would be achieved (and further, you'd need an Else or a Switch component anyway if going down this route). Maybe you could explain the benefits of such a path?Regardless of serialization/replay-ability, the core of the suggestion is to `import` some constant instead of using raw strings. Symbols have the benefit of forcing an import, whereas a list of constants that reference strings can be "bypassed" by writing the correct string in a random file. In fact, the redux actions documentation uses the following example of this pattern as the first example.
``` // fileA const ADD_TODO = 'ADD_TODO'
//fileB { type: ADD_TODO, text: 'Build my first Redux app' } ```
brew install docker-machine
docker-machine create --name myserver ...digital-ocean-options
eval $(docker-machine env myserver)
docker ps
that is:* install docker-machine
* provision a droplet with docker on it (you can also use test.docker.com to use an RC instead of the latest release)
* set your local shell env to point docker to said machine
* use the docker client to interact with said machine
I also use docker-for-mac and a similar process to spin up swarm-mode clusters. You can also ssh into the machine if you need to by `docker-machine ssh myserver`
In addition, the React way allows you a full language to handle import/export for "templates" instead of relying on a hampered template language/partials implementation.
The key here isn't the specific instance of frontmatter, it's having the flexibility to use everything one might use to build a SPA to target static sites. This re-use of existing solutions and skills is important.
It also allows the use of React's ecosystem, such as react-helmet[0], which makes it easier to change the meta tags and title on the page when rendering.