-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add State Docs #171
Add State Docs #171
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make these changes
src/State/README.md
Outdated
```haskell | ||
State s a | ||
``` | ||
`State` is an Algebraic Data Type that abstracts away state management |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Algebraic Data Type that abstracts away state management associated when working with stateful computations
Should be:
Algebraic Data Type that abstracts away the associated state management that comes with stateful computations.
src/State/README.md
Outdated
``` | ||
`State` is an Algebraic Data Type that abstracts away state management | ||
associated when working with stateful computations.`State` is parameterized by | ||
two types, a state `s` and a resultant `a`. The `a` may vary it's type, but |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a
may vary it's type
Resultant may vary it's type
src/State/README.md
Outdated
`State` is an Algebraic Data Type that abstracts away state management | ||
associated when working with stateful computations.`State` is parameterized by | ||
two types, a state `s` and a resultant `a`. The `a` may vary it's type, but | ||
the `s` must be fixed to a type that is used by all related stateful |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
s
must be fixed to a type
the state must be fixed to a type
src/State/README.md
Outdated
All `State` instances wrap a function of the form `s -> Pair a s` and can be | ||
constructed by providing a function of this form. In order to get maximum | ||
reuse of existing functions, a few construction helpers are available on | ||
`State` constructor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
State
constructor.
the State
constructor.
src/State/README.md
Outdated
|
||
`State` is lazy and is required to be run at the edge with some initial state. | ||
Three methods are available on the instance for running the `State` with a | ||
given initial state. `runWith` will return a `Pair a s` with the state `s` on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add on page link to runWith
src/State/README.md
Outdated
value to run the instance with. The value must be a member of the type that the | ||
given `State` instance is fixed to in it's state portion, `s`. | ||
|
||
`evalWith`, when called with a value, will run the state transition with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
evalWith
, when called with a value, will run the state
When called, evalWith
will run the state
src/State/README.md
Outdated
given `State` instance is fixed to in it's state portion, `s`. | ||
|
||
`evalWith`, when called with a value, will run the state transition with the | ||
given value as the initial state and will return the resulting resultant and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return the resulting resultant and will discard the state portion.
return the resulting resultant, discarding the state portion.
src/State/README.md
Outdated
value to run the instance with. The value must be a member of the type that the | ||
given `State` instance is fixed to in it's state portion, `s`. | ||
|
||
`execWith`, when called with a value, will run the state transition with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
execWith
, when called with a value, will run the state
When called, execWith
will run the state
src/State/README.md
Outdated
|
||
`execWith`, when called with a value, will run the state transition with the | ||
given value as the initial state and will return the resulting state and will | ||
discard the resultant portion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return the resulting state and will discard the resultant portion.
return the resulting state, discarding the resultant portion.
src/State/README.md
Outdated
|
||
const compose = require('crocks/helpers/compose') | ||
const curry = require('crocks/helpers/curry') | ||
const evalWith = require('crocks/State/evalWith') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move upstairs.
Much Punk
This PR marks off another item from this issue and adds the README for documentation for the
src/State
bit of code.