evancz Mar 23, 2017 00:43
Just so folks are aware, one of the hard things about having ports just be a Task is the following. Right now, a Task is guaranteed to terminate with an error or a result.
The only way it could be otherwise is if you have something of type Task Never Never
Now, if you are calling out to random JS that is written by anyone, that guarantee goes away.
You have to call some callback to give the value back to Elm, but what if that is never called?
Maybe there's an error, maybe there is a weird code path.
Now Elm code can "leak" tasks that never get completed because of problems in JS code.
One way to protect against this is to have timeouts, such that there is some guaranteed end.
My point here is just that it is more complicated than "what if it was a task?" and then everything would be nice.
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 Cart where | |
-- An Item is just a record (like an object in JS). | |
data Item | |
= Item | |
{ name :: String | |
, quantity :: Int | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x
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
import React from 'react'; | |
import { render } from 'react-dom'; | |
import yup from 'yup'; | |
import Form from 'react-formal'; | |
const schema = yup.object({ | |
test: yup.string() | |
}); |
Installing Ghost is much more complicated than it is described in the docs. Here are a few additional steps needed do get it up and running.
####Clone the git repository I cannot get to work any of the random releases files I've downloaded, so start off with a fresh repo and follow the few steps that the guide actually provides.
git clone https://github.com/TryGhost/Ghost.git ghost
cd ghost
npm install
npm start
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
// .bash_aliases | |
// alias cdg='cd `node /path/to/script/nearestGitFolder.js`' | |
var fs = require('fs'); | |
var hasGitDir = function(path) { | |
return fs.existsSync(path + '/.git'); | |
} |
NewerOlder