Skip to content
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

New Webapp #118

Open
wants to merge 175 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
fd73c77
new webapp uses react/redux
michaelbjames Feb 21, 2020
001545c
wip
michaelbjames Feb 21, 2020
2258527
WIP
Feb 21, 2020
280fd9b
refactor type checking module
Feb 22, 2020
f657e1c
add support for example checking
Feb 22, 2020
f538443
add bootstrap
michaelbjames Feb 22, 2020
4c4d1b9
table is editable, with hard coded columns
michaelbjames Feb 23, 2020
a6ffe96
show usage table
michaelbjames Feb 23, 2020
5496796
reorganize and reduce boilerplate -- add redux dev toolkit
michaelbjames Feb 24, 2020
6a762e6
add json string parsing
Feb 24, 2020
1a6a2c4
support for io json
Feb 24, 2020
f15bfc8
pass code to candidate list
michaelbjames Feb 24, 2020
72331b0
updated web readme
michaelbjames Feb 24, 2020
a4b4f3c
add promise to mock adding a candidate
michaelbjames Feb 24, 2020
5e96cfa
include spinner
michaelbjames Feb 24, 2020
305ab96
add usage up top
michaelbjames Feb 24, 2020
720f39c
support for output as ??
Feb 24, 2020
90bd5c1
change default parameters
Feb 25, 2020
064ec9b
add new route, for getting result about one usage
michaelbjames Feb 25, 2020
a25aa66
add loading and error states to the usage table
michaelbjames Feb 25, 2020
7aff0aa
manipulate usage / examples
michaelbjames Feb 25, 2020
d29cfb5
switch to LogicT
Feb 25, 2020
f06c376
minor fix
Feb 25, 2020
2621dc8
WIP
Feb 27, 2020
e5c363c
WIP: update logic monad
aaronguo1996 Feb 27, 2020
c99793f
WIP: update time stats
aaronguo1996 Feb 27, 2020
0ed3a8a
fix the minor bugs
aaronguo1996 Feb 27, 2020
61062ce
fix the minor bugs (#61, #43)
aaronguo1996 Feb 27, 2020
6002f13
Merge branch 'zheng_param_order' of github.com:davidmrdavid/hoogle_pl…
aaronguo1996 Feb 27, 2020
d2d48d6
init web server
aaronguo1996 Feb 28, 2020
24ea147
add builtin json
aaronguo1996 Feb 28, 2020
7fa06fc
Merge branch 'zheng_param_order' into zheng_mid_layer
aaronguo1996 Feb 28, 2020
9335b25
add start script (#64)
Feb 28, 2020
9b792e5
use react-bootstrap; include base modal
michaelbjames Feb 28, 2020
8909b4c
modal pops up
michaelbjames Feb 28, 2020
dd2cc00
UI will pop up when no type is entered. needs styling
michaelbjames Feb 28, 2020
3963f3d
add more json format for web (#64)
aaronguo1996 Feb 28, 2020
2147d86
Merge branch 'zheng_mid_layer' of github.com:davidmrdavid/hoogle_plus…
aaronguo1996 Feb 28, 2020
d1e4cf6
add more examples (#64)
aaronguo1996 Feb 28, 2020
56a82fe
fix minor bugs
aaronguo1996 Feb 28, 2020
c5a46b0
fix compilation error
aaronguo1996 Feb 28, 2020
c3c204c
use accordian cards for candidate list
michaelbjames Feb 28, 2020
b0635ef
update existing example specs
michaelbjames Feb 28, 2020
ecd994e
break out spinnable cell
michaelbjames Feb 28, 2020
7379ad7
generate new example gets uuid
michaelbjames Feb 28, 2020
a8d9702
change an example spec, prop down
michaelbjames Feb 28, 2020
031d549
update routes
michaelbjames Feb 29, 2020
1105552
update hplus for all routes support (#64)
aaronguo1996 Feb 29, 2020
91644e6
propagate changes across usage
michaelbjames Feb 29, 2020
8b7e650
Merge branch 'mj_new_webapp' of github.com:/davidmrdavid/hoogle_plus …
michaelbjames Feb 29, 2020
0d42568
add more examples button
michaelbjames Feb 29, 2020
d82e3ac
bugfix: keep usage on updated result overwrites previous spec
michaelbjames Mar 2, 2020
35510b2
add error support (#64)
aaronguo1996 Mar 3, 2020
808f548
cannot test stop, wait for front end
aaronguo1996 Mar 3, 2020
2fc46bc
try to fetch first
michaelbjames Mar 3, 2020
74dd678
use development flag
michaelbjames Mar 3, 2020
22de2cf
Merge branch 'zheng_mid_layer' into mj_new_webapp
michaelbjames Mar 3, 2020
243dd5b
change request json parse method
aaronguo1996 Mar 3, 2020
a464525
use flask port and disable CORS check
michaelbjames Mar 3, 2020
a6fe972
Merge remote-tracking branch 'origin/zheng_mid_layer' into mj_new_webapp
michaelbjames Mar 3, 2020
8277818
live request for type
michaelbjames Mar 4, 2020
c937269
permit CORS
michaelbjames Mar 4, 2020
3f9e6d9
WIP search for types from examples endpoint
michaelbjames Mar 4, 2020
5bd10c1
move gateway files
michaelbjames Mar 4, 2020
6bb40c6
error is not loading
michaelbjames Mar 4, 2020
ab3760d
enter to submit type query
michaelbjames Mar 4, 2020
1f44327
convert to json
michaelbjames Mar 4, 2020
3a654c3
add feature manager to disable features selectively
michaelbjames Mar 5, 2020
3b9f652
update readme
michaelbjames Mar 5, 2020
700eb27
return a monotype when search types (#70)
aaronguo1996 Mar 5, 2020
2d8cf71
dont send empty facts
michaelbjames Mar 6, 2020
b32c352
add new type inference algorithm
aaronguo1996 Mar 8, 2020
696fede
fix minor bugs in type inference algorithm
Mar 9, 2020
05c320a
permute arguments in query types
Mar 9, 2020
f36d5bb
pretty print infix operators (#51)
Mar 9, 2020
1dd477c
fix bugs in arg permutations
Mar 9, 2020
2a7d9ca
rule out error generalization
Mar 9, 2020
ac0ebf8
Merge remote-tracking branch 'origin/zheng_mid_layer' into new_webapp
michaelbjames Mar 9, 2020
75b6d01
send examples with correct format; modal looks better
michaelbjames Mar 9, 2020
f3e0af9
use inputs/output format elsewhere
michaelbjames Mar 9, 2020
3159853
use examplesStatus in the default state of the new candidates
michaelbjames Mar 9, 2020
9db15e8
show error message for more examples button
michaelbjames Mar 10, 2020
5862830
move baseroute to the fetches utility file
michaelbjames Mar 10, 2020
4c16e7c
centered table headers
michaelbjames Mar 10, 2020
0245145
Merge back (#72)
michaelbjames Mar 11, 2020
0acf0f2
better layout, with syntax highlighting
michaelbjames Mar 11, 2020
f6d3c5b
break apart search
michaelbjames Mar 11, 2020
29ba003
WIP
michaelbjames Mar 11, 2020
60196f4
set loading on search
michaelbjames Mar 11, 2020
335140a
remove dead component
michaelbjames Mar 11, 2020
d457754
remove dead action type
michaelbjames Mar 11, 2020
575adf5
Incremental Checkin (#78)
michaelbjames Mar 11, 2020
1b93839
pass documents from hoogle to front end
Mar 12, 2020
b9f0c64
fix bug for hof
Mar 12, 2020
e345cb3
add timeout in case of infinite execution
Mar 12, 2020
559d678
fix format bugs
Mar 12, 2020
a73e8dc
prevent empty fold
michaelbjames Mar 12, 2020
808da5f
fix hoogle db path
Mar 12, 2020
ddfc43d
Mj webapp docs (#84)
michaelbjames Mar 12, 2020
1a34aab
Merge branch 'zheng_mid_layer' into new_webapp
Mar 13, 2020
f927da3
Merge remote-tracking branch 'origin/mj_new_webapp' into new_webapp
Mar 13, 2020
f7e47be
fixed alignment and styling on page (#83)
shivanidoshi26 Mar 13, 2020
f3ffa0f
fix path error (#81)
Mar 13, 2020
3af1f32
Merge branch 'zheng_mid_layer' into new_webapp
Mar 13, 2020
6b5bac5
Hp new webapp (#82)
peleghila Mar 13, 2020
29674c0
pre study UI fixes (#86)
michaelbjames Mar 13, 2020
702274d
accept example changes (#87)
michaelbjames Mar 14, 2020
f1b5914
Zheng mid layer (#89)
aaronguo1996 Mar 14, 2020
4ce38df
Merge branch 'new_webapp' of github.com:davidmrdavid/hoogle_plus into…
Mar 14, 2020
087c9cd
counting args correctly (#90)
peleghila Mar 16, 2020
b8bd143
use Hoogle+ instead of React-App
michaelbjames Mar 16, 2020
b10b162
Merge branch 'new_webapp' of github.com:davidmrdavid/hoogle_plus into…
Mar 17, 2020
c5a14bf
Fix argname issue and a filter bug in h+ (#97)
aaronguo1996 Mar 17, 2020
4703cbb
add stop button and support (#104)
aaronguo1996 Mar 21, 2020
ad5384d
New example table (#107)
michaelbjames Mar 22, 2020
a7f6e83
show alert on error instead of blocking input (#108)
michaelbjames Mar 23, 2020
beb3e3c
More Examples (#109)
michaelbjames Mar 23, 2020
a07ef14
Docs on tooltip (#110)
michaelbjames Mar 23, 2020
510e7ea
Cleanup
michaelbjames Mar 25, 2020
790a6ff
add new usages
michaelbjames Mar 25, 2020
d963a64
Zheng tyclass (#111)
aaronguo1996 Mar 25, 2020
4c70a61
Merge branch 'new_webapp' of github.com:davidmrdavid/hoogle_plus into…
Mar 25, 2020
19726a9
fix merge bug
Mar 25, 2020
9469148
handle errors with example update call
michaelbjames Mar 26, 2020
cc23ec4
Merge branch 'new_webapp' of github.com:/davidmrdavid/hoogle_plus int…
michaelbjames Mar 26, 2020
f9886c9
fix stop button issues (#115)
michaelbjames Mar 27, 2020
f6a0ee6
add dependencies.txt
michaelbjames Mar 27, 2020
d028b4b
Merge branch 'new_webapp' of github.com:davidmrdavid/hoogle_plus into…
michaelbjames Mar 27, 2020
53a5145
stop button can only be pressed when you can stop something
michaelbjames Mar 27, 2020
17c23e1
Zheng hot fix (#116)
aaronguo1996 Mar 27, 2020
4eaed08
revert the type checking for examples (#117)
aaronguo1996 Mar 27, 2020
a75225e
search for type hotfix
michaelbjames Mar 27, 2020
74ebabb
Zheng example generate (#119)
aaronguo1996 Apr 2, 2020
f3e7e5c
Zheng webapp fix (#121)
aaronguo1996 Apr 2, 2020
0ea8df0
Zheng webapp fix2 (#122)
aaronguo1996 Apr 3, 2020
84abc80
Pilot fixes (#123)
michaelbjames Apr 6, 2020
865911a
fix packages deps
michaelbjames Apr 6, 2020
779f462
flavortext change
michaelbjames Apr 9, 2020
bfa3a39
Zheng cherry pick (#124)
aaronguo1996 Apr 10, 2020
e7c4e21
pilot fixes (#132)
michaelbjames Apr 13, 2020
95d7e4c
Pretty-print HOF IOs, Fix non-termination evaluation (#131)
mistzzt Apr 13, 2020
0659c56
Zheng infer tyclass (#134)
aaronguo1996 Apr 16, 2020
c55cf37
Zheng infer bug (#136)
aaronguo1996 Apr 17, 2020
3053add
Optimize not failing check and implement more examples (#135)
mistzzt Apr 17, 2020
cf43e67
move print earlier
Apr 17, 2020
1122a25
Zheng infer order (#137)
aaronguo1996 Apr 17, 2020
ff6a2cb
FE Parser (#141)
michaelbjames Apr 20, 2020
f77d29d
refine text bug
michaelbjames Apr 21, 2020
afadcee
Zheng merge filter (#142)
aaronguo1996 Apr 22, 2020
97cd5bf
Include supertype conversion functions for typeclass heirarchy ord ->…
michaelbjames Apr 22, 2020
09ef868
Merge branch 'new_webapp' of github.com:davidmrdavid/hoogle_plus into…
michaelbjames Apr 22, 2020
6d429cc
Zheng func print (#144)
aaronguo1996 Apr 22, 2020
f33b46e
Implement strategy 1 and upload script comparing strategy (#145)
aaronguo1996 Apr 23, 2020
3b55f24
feed and print nice functions (#146)
aaronguo1996 Apr 23, 2020
e4cd0d4
move from x*2 to x*3
aaronguo1996 Apr 23, 2020
094977d
left align docs, fix example error (#147)
aaronguo1996 Apr 24, 2020
3dd5a85
Wrap negative numbers (#148)
aaronguo1996 Apr 24, 2020
68e696f
fix issues for function arities more than 2; fix issues for function …
aaronguo1996 Apr 24, 2020
16c1dbd
Loading block on usage change; add usage to 1 cand
michaelbjames Apr 26, 2020
9ad7cd0
put a new usage at the TOP of the list
michaelbjames Apr 28, 2020
4cc7db3
fix issue #150
aaronguo1996 May 4, 2020
fd99e23
Add `CompareSolutions` experiment script
mistzzt May 6, 2020
3d3a127
Fix script
mistzzt May 6, 2020
b669b13
Revert cherry pick
mistzzt May 6, 2020
9e77916
inference eval; bug fix for inference
aaronguo1996 May 7, 2020
e775d93
experiments
aaronguo1996 May 11, 2020
517dbf7
Merge branch 'ziteng_rank_full' of github.com:davidmrdavid/hoogle_plu…
aaronguo1996 May 11, 2020
72b084a
fix #151
aaronguo1996 May 11, 2020
f5324a9
Zheng infer eval (#153)
aaronguo1996 May 28, 2020
66fc57c
Update container
mistzzt Jul 2, 2020
6f14e00
merge
aaronguo1996 Jul 9, 2020
4b2a8e5
expose port for flask
aaronguo1996 Jul 19, 2020
d230921
Zheng infer eval (#158)
aaronguo1996 Aug 4, 2020
a375823
fix for website depolyment
Nov 4, 2020
eaae4e6
fix type checking for PApp
aaronguo1996 Nov 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion new_webapp/src/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as Consts from "../constants/action-types";
import _ from "underscore";
import { hooglePlusTypeSearch, ghciUsage, hooglePlusExampleSearch } from "../gateways";
import { hooglePlusTypeSearch, ghciUsage, hooglePlusExampleSearch, hooglePlusMoreExamples } from "../gateways";
import { namedArgsToUsage } from "../utilities/args";
import { LOADING, DONE } from "../constants/fetch-states";

function makeActionCreator(type, ...argNames) {
return function (...args) {
@@ -31,6 +32,7 @@ export const setSearchTypeInternal = makeActionCreator(Consts.SET_SEARCH_TYPE, "
export const setExampleEditingRow = makeActionCreator(Consts.SET_EXAMPLE_EDITING_ROW, "payload");
export const setExamples = makeActionCreator(Consts.SET_EXAMPLES, "payload");
export const updateCandidateUsageTable = makeActionCreator(Consts.UPDATE_CANDIDATE_USAGE, "payload");
export const fetchMoreCandidateUsages = makeActionCreator(Consts.FETCH_MORE_CANDIDATE_USAGES, "payload");

export const setModalOpen = makeActionCreator(Consts.MODAL_OPEN);
export const setModalClosed = makeActionCreator(Consts.MODAL_CLOSE);
@@ -97,4 +99,17 @@ const handleCandidates = (dispatch, serverPromise) => {
return value;
})
.then(value => dispatch(addCandidate(value)));
}

export const getMoreExamples = ({candidateId, code, usages}) => (dispatch, getState) => {
const {spec} = getState();
dispatch(fetchMoreCandidateUsages({candidateId, status: LOADING}));
return hooglePlusMoreExamples({code, usages, queryType: spec.searchType})
.then(({examples}) => {
return dispatch(fetchMoreCandidateUsages({
candidateId,
status: DONE,
result: examples
}));
});
}
94 changes: 57 additions & 37 deletions new_webapp/src/components/CandidateList.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from "react";
import { Button, Card } from "react-bootstrap";
import Collapsible from "react-collapsible";
import { connect } from "react-redux";
import UsageTable from "./UsageTable";
import { BounceLoader } from "react-spinners";
import Collapsible from "react-collapsible";
import { Card } from "react-bootstrap";
import UsageTable from "./UsageTable";
import { getMoreExamples } from "../actions";

const mapStateToProps = state => {
return {
@@ -13,42 +14,61 @@ const mapStateToProps = state => {
};
}

const CandidateListBase = ({candidates, numArgs, isFetching}) => (
<div>
{candidates.map(({code, examples, candidateId}, idx) => {
const header = (
<Card.Header>
{idx + 1}:
<span>Candidate: <code>{code}</code></span>
</Card.Header>
);
return (
<Card key={idx}>
<Collapsible
open={true}
trigger={header}>
<Card.Body>
<UsageTable
candidateId={candidateId}
code={code}
rows={examples}
numColumns={numArgs + 1}
/>
</Card.Body>
</Collapsible>
</Card>
);
})
}
{/* https://www.npmjs.com/package/react-spinners */}
<div className="container">
<div className="row justify-content-center">
<BounceLoader loading={isFetching}/>
const mapDispatchToProps = dispatch => {
return {
getMoreExamples: ({candidateId, code, usages}) => dispatch(getMoreExamples({candidateId, code, usages})),
}
};

const ConnectedCandidateList = (props) => {
const {candidates, numArgs, isFetching, getMoreExamples} = props;
return (
<div>
{candidates.map((result, idx) => {
const {code, examples, examplesLoading, candidateId} = result;
const header = (
<Card.Header>
{idx + 1}:
<span>Candidate: <code>{code}</code></span>
</Card.Header>
);
const usages = examples.map(ex => ex.usage);
const handleClick = () => getMoreExamples({candidateId, code, usages});
return (
<Card key={idx}>
<Collapsible
open={true}
trigger={header}>
<Card.Body>
<UsageTable
candidateId={candidateId}
code={code}
rows={examples}
numColumns={numArgs + 1}
/>
<Button
variant="outline-primary"
size="sm"
disabled={examplesLoading}
onClick={examplesLoading ? null : handleClick}>
{examplesLoading ? "Loading..." : "More examples"}
</Button>
</Card.Body>
</Collapsible>
</Card>
);
})
}
{/* https://www.npmjs.com/package/react-spinners */}
<div className="container">
<div className="row justify-content-center">
<BounceLoader loading={isFetching}/>
</div>
</div>
</div>
</div>
);
)
};

const CandidateList = connect(mapStateToProps)(CandidateListBase);
const CandidateList = connect(mapStateToProps, mapDispatchToProps)(ConnectedCandidateList);

export default CandidateList;
3 changes: 2 additions & 1 deletion new_webapp/src/constants/action-types.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
export const ADD_CANDIDATE = "ADD_CANDIDATE";
export const UPDATE_CANDIDATE_USAGE = "UPDATE_CANDIDATE_USAGE";
export const FETCH_MORE_CANDIDATE_USAGES = "FETCH_MORE_CANDIDATE_USAGES";

export const ADD_FACT = "ADD_FACT";
export const SET_EXAMPLES = "SET_EXAMPLES";
export const SET_EXAMPLE_EDITING_ROW = "SET_EDITING_CELLS";

export const SET_SEARCH_TYPE = "SET_SEARCH_TYPE";
export const SET_NEW_SEARCH = "SET_NEW_SEARCH";

3 changes: 3 additions & 0 deletions new_webapp/src/constants/fetch-states.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const LOADING = "Loading";
export const DONE = "Done";
export const ERROR = "Error";
11 changes: 10 additions & 1 deletion new_webapp/src/gateways/index.js
Original file line number Diff line number Diff line change
@@ -61,4 +61,13 @@ export const ghciUsage = ({code, args}) => {
} else {
return mockError;
}});
};
};

export const hooglePlusMoreExamples = ({code, usages, queryType}) => {
const mockExamples = [
["z", "3", "zzz"],
["z", "0", ""]
];
return delay(1000)
.then(_ => {return {examples: mockExamples}});
}
54 changes: 50 additions & 4 deletions new_webapp/src/reducers/candidateReducer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import * as Consts from "../constants/action-types";
import { LOADING, DONE } from "../constants/fetch-states";
import {v4 as uuidv4} from "uuid";

export const initialCandidateState = {
isFetching: false,
results: [
{
candidateId: "cand1",
code: "\\arg0 arg1-> replicate arg0 arg1",
examplesLoading: false,
examples: [
{
id: "0",
@@ -22,6 +25,7 @@ export const initialCandidateState = {
{
candidateId: "cand2",
code: "\\arg0 arg1-> replicate2 arg0 arg1",
examplesLoading: false,
examples: [
{
id: "0",
@@ -33,6 +37,14 @@ export const initialCandidateState = {
]
};

const usageToExample = (usage) => {
return {
id: uuidv4(),
usage: usage,
isLoading: false,
};
}

export function candidateReducer(state = initialCandidateState, action){
switch(action.type) {
case Consts.ADD_CANDIDATE:
@@ -45,22 +57,56 @@ export function candidateReducer(state = initialCandidateState, action){
results: [],
isFetching: true,
}
case Consts.FETCH_MORE_CANDIDATE_USAGES:
const {candidateId:fCandidateId, status} = action.payload;
switch (status) {
case LOADING:
const newLoadingResults = state.results.map((result) => {
if (result.candidateId === fCandidateId) {
return {
...result,
examplesLoading: true,
};
}
return result;
});
return {...state, results: newLoadingResults};
case DONE:
const newExampleResults = state.results.map((result) => {
if (result.candidateId === fCandidateId) {
const newUsages = action.payload.result;
const newExamples = newUsages.map(usageToExample);
return {
...result,
examplesLoading: false,
examples: result.examples.concat(newExamples)
};
}
return result;
});
return {...state, results: newExampleResults};
}
return {
...state,
};
case Consts.UPDATE_CANDIDATE_USAGE:
const {candidateId, usageId} = action.payload;
const {candidateId:uCandidateId, usageId} = action.payload;
const updatedResults = state.results.map(result => {
if(result.candidateId === candidateId) {
if(result.candidateId === uCandidateId) {
const updatedExamples = result.examples.map(example => {
if (example.id === usageId) {
if (action.payload.args) {
return {id: example.id,
return {
id: example.id,
usage: action.payload.args.concat(null),
isLoading: true,
};
}
if (action.payload.result) {
let updatedUsage = Array.from(example.usage);
updatedUsage[updatedUsage.length - 1] = action.payload.result;
return {id: example.id,
return {
id: example.id,
usage: updatedUsage,
isLoading: false,
};
1 change: 1 addition & 0 deletions new_webapp/src/reducers/specReducer.js
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ export const initialSpecState = {
usage: ["x", "2", "xx"]
}],
numArgs: 2,
searchType: null,
searchTypeOptions: [
"foo",
"bar"