Added links to ramda's awesome type signature documentation and a SO describing Hindley-Milner (#85)

Adjusted wording of the PS
This commit is contained in:
Jethro Larson 2016-07-27 00:54:27 -07:00 committed by hemanth.hm
parent da2cca182d
commit 4cd9112fbb

View file

@ -552,7 +552,7 @@ TODO
## Type Signatures
Often functions will include comments that indicate the types of their arguments and return types.
Often functions in JavaScript will include comments that indicate the types of their arguments and return values.
There's quite a bit of variance across the community but they often follow the following patterns:
@ -573,13 +573,18 @@ If a function accepts another function as an argument it is wrapped in parenthes
const call = (f) => (x) => f(x)
```
The letters `a`, `b`, `c`, `d` are used to signify that the argument can be of any type. For this `map` it takes a function that transforms a value of some type `a` into another type `b`, an array of values of type `a`, and returns an array of values of type `b`.
The letters `a`, `b`, `c`, `d` are used to signify that the argument can be of any type. The following version of `map` takes a function that transforms a value of some type `a` into another type `b`, an array of values of type `a`, and returns an array of values of type `b`.
```js
// map :: (a -> b) -> [a] -> [b]
const map = (f) => (list) => list.map(f)
```
### Further reading
* [Ramda's type signatures](https://github.com/ramda/ramda/wiki/Type-Signatures)
* [Mostly Adaquate Guide](https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch7.html#whats-your-type)
* [What is Hindley-Milner?](http://stackoverflow.com/a/399392/22425) on Stack Overflow
## Union type
A union type is the combination of two types together into another one.
@ -663,4 +668,4 @@ getNestedPrice({item: {price: 9.99}}); // Some(9.99)
---
__P.S:__ Without the wonderful [contributions](https://github.com/hemanth/functional-programming-jargon/graphs/contributors) this repo would be meaningless!
__P.S:__ This repo is successful due to the wonderful [contributions](https://github.com/hemanth/functional-programming-jargon/graphs/contributors)!