Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 890aff0

Browse files
committed
example 3
1 parent 4a1a4a2 commit 890aff0

File tree

5 files changed

+94
-96
lines changed

5 files changed

+94
-96
lines changed

‎docs/src/main/tut/examples/example.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { render } from 'react-dom';
33
import '../../../../../src/xs/rx'
4-
import { Applicative, lift2, Functor, map } from '../../../../../src/fantasy'
4+
import { Applicative, lift2,Semigroup, Functor, map } from '../../../../../src/fantasy'
55
import {X} from '../../../../../src'
66
function xmount(component, dom) { render(React.createFactory(X)({}, component), dom) }
77

@@ -36,3 +36,20 @@ let ViewEg2 = props => <section>
3636
let Eg2 = Xeg2.apply(ViewEg2)
3737

3838
xmount(<Eg2/>, document.getElementById('eg2') )
39+
40+
let Xeg3 = Semigroup.Xstream.concat(
41+
Semigroup.Xstream.concat(
42+
Xstream.fromEvent('change', 'firstName', 'Jichao'),
43+
Applicative.Xstream.pure(' ')
44+
),
45+
Xstream.fromEvent('change', 'lastName', 'Ouyang')
46+
).toFantasyX()
47+
let ViewEg3 = props => <section>
48+
<p><input type="text" name="firstName" onChange={props.actions.fromEvent} defaultValue="Jichao" /></p>
49+
<p><input type="text" name="lastName" onChange={props.actions.fromEvent} defaultValue="Ouyang"/></p>
50+
<p><span className="result">{props.semigroup}</span></p>
51+
</section>
52+
53+
let Eg3 = Xeg3.map(a=>({semigroup: a})).apply(ViewEg3)
54+
55+
xmount(<Eg3/>, document.getElementById('eg3') )

‎docs/src/main/tut/examples/index.html

Lines changed: 55 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/src/main/tut/examples/index.org

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import * as React from 'react';
1212
import { render } from 'react-dom';
1313
import '../../../../../src/xs/rx'
14-
import { Applicative, lift2, Functor, map } from '../../../../../src/fantasy'
14+
import { Applicative, lift2,Semigroup, Functor, map } from '../../../../../src/fantasy'
1515
import {X} from '../../../../../src'
1616
function xmount(component, dom) { render(React.createFactory(X)({}, component), dom) }
1717
#+END_SRC
@@ -69,26 +69,29 @@ xmount(<Eg2/>, document.getElementById('eg2') )
6969

7070
#+HTML: <p><div id="eg2"></div></p>
7171

72-
# * Example 3: Semigroup
73-
# #+BEGIN_SRC js :tangle example.tsx
74-
# let Xeg3 = fromEvent('change', 'firstName', 'Jichao')
75-
# .concat(pure(' '))
76-
# .concat(fromEvent('change', 'lastName', 'Ouyang'))
77-
78-
# let ViewEg3 = props => <section>
79-
# <p><input type="text" name="firstName" onChange={props.actions.fromEvent} defaultValue="Jichao" /></p>
80-
# <p><input type="text" name="lastName" onChange={props.actions.fromEvent} defaultValue="Ouyang"/></p>
81-
# <p><span className="result">{props.semigroup}</span></p>
82-
# </section>
72+
* Example 3: Semigroup
73+
#+BEGIN_SRC js :tangle example.tsx
74+
let Xeg3 = Semigroup.Xstream.concat(
75+
Semigroup.Xstream.concat(
76+
Xstream.fromEvent('change', 'firstName', 'Jichao'),
77+
Applicative.Xstream.pure(' ')
78+
),
79+
Xstream.fromEvent('change', 'lastName', 'Ouyang')
80+
).toFantasyX()
81+
let ViewEg3 = props => <section>
82+
<p><input type="text" name="firstName" onChange={props.actions.fromEvent} defaultValue="Jichao" /></p>
83+
<p><input type="text" name="lastName" onChange={props.actions.fromEvent} defaultValue="Ouyang"/></p>
84+
<p><span className="result">{props.semigroup}</span></p>
85+
</section>
8386

84-
# let Eg3 = Xeg3.map(a=>({semigroup: a})).apply(ViewEg3)
85-
# #+END_SRC
87+
let Eg3 = Xeg3.map(a=>({semigroup: a})).apply(ViewEg3)
88+
#+END_SRC
8689

87-
# #+BEGIN_SRC js :tangle example.tsx :exports none
88-
# xmount(<Eg3/>, document.getElementById('eg3') )
89-
# #+END_SRC
90+
#+BEGIN_SRC js :tangle example.tsx :exports none
91+
xmount(<Eg3/>, document.getElementById('eg3') )
92+
#+END_SRC
9093

91-
# #+HTML: <p><div id="eg3"></div></p>
94+
#+HTML: <p><div id="eg3"></div></p>
9295

9396
# * Example 4: Traverse
9497

‎package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"@types/node": "^8.0.0",
4141
"@types/prop-types": "^15.5.2",
4242
"@types/react": "^16.0.13",
43-
"@types/react-dom": "^16.0.1",
4443
"browserify": "^14.4.0",
4544
"browserify-shim": "^3.8.14",
4645
"chai": "^4.1.2",

‎yarn.lock

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
version "20.0.8"
2323
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-20.0.8.tgz#7f8c97f73d20d3bf5448fbe33661a342002b5954"
2424

25-
"@types/node@*":
26-
version "8.0.33"
27-
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.33.tgz#1126e94374014e54478092830704f6ea89df04cd"
28-
2925
"@types/node@^7.0.18":
3026
version "7.0.43"
3127
resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.43.tgz#a187e08495a075f200ca946079c914e1a5fe962c"
@@ -38,17 +34,6 @@
3834
version "15.5.2"
3935
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.5.2.tgz#3c6b8dceb2906cc87fe4358e809f9d20c8d59be1"
4036

41-
"@types/react-dom@^16.0.1":
42-
version "16.0.1"
43-
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.0.1.tgz#de159d00dd70050000f462e8bcff0c08ef803dee"
44-
dependencies:
45-
"@types/node" "*"
46-
"@types/react" "*"
47-
48-
"@types/react@*":
49-
version "16.0.10"
50-
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.0.10.tgz#a24b630f5f1f170866a148a147d4fc8636ea88e0"
51-
5237
"@types/react@^16.0.13":
5338
version "16.0.13"
5439
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.0.13.tgz#973836e6deec10184937322cd10a1605f9de81fc"

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /