Comments (7)
For the general query language problem, Text.Megaparsec.Expr is extremely well suited. It lets you define unary and binary operators of various precedence levels. If I can figure out how to contribute I plan to try to write this with it.
from toodles.
I like it! While I can see the benefit (and fun!) of building this into the backend, I'm thinking it might be a pre-optimization. To me it sounds easier to just add this new logic to the frontend, and avoid the back-and-forth to the server. What do you think?
from toodles.
I don't know what you mean. Are you saying just provide two windows, one for include and one for exclude? Or do you mean to parse boolean queries, just not in the backend? I'm not yet close enough to the code to know what to call back end and front end.
from toodles.
I meant the latter. The javascript that powers the web UI of toodles should be able to handle this, so I was suggesting there might not be any Haskell to write here, at least not at first.
from toodles.
It could be done in Javascript, I agree -- but why? It'd be far more code, and less safe, and harder to learn or modify. Megaparsec.Expr lets you write a parser for unary and binary operators of different precedence levels in as little as this much code:
expr = makeExprParser term table <?> "expression"
term = parens expr <|> integer <?> "term"
table = [ [ prefix "-" negate
, prefix "+" id ]
, [ postfix "++" (+1) ]
, [ binary "*" (*)
, binary "/" div ]
, [ binary "+" (+)
, binary "-" (-) ] ]
binary name f = InfixL (f <$ symbol name)
prefix name f = Prefix (f <$ symbol name)
postfix name f = Postfix (f <$ symbol name)
from toodles.
Apologies for the late response here, must have missed the notification of your reply.
I'm on board with your suggestion.
Just for context on I was coming from: currently the UI does this filtering right now, so the Haskell code is not involved. So I was questioning if the complexity of the parsing you are describing even justifies the complexity of simply going back and forth with the server at all. Sounds like it does though :)
from toodles.
@JeffreyBenjaminBrown let me know if you need any help getting this working!
from toodles.
Related Issues (20)
- permit|assume a default priority level HOT 2
- How does your develop-test cycle work? HOT 2
- Report all tags
- May I subdivide it into modules? HOT 2
- metadata modifications disappear when refreshing the browser window HOT 1
- deleting a TODO item also deletes the line following HOT 3
- High memory usage, suspected memory leak HOT 1
- 'stack install toodles' downloads 3,5GB of stuff HOT 2
- Show more context, like the -C option to grep HOT 1
- Add xml/xaml
- docker build issues since 1.0.0 HOT 5
- Parser is too slow HOT 1
- Dependency tracking
- Installing with Stack base dependency issue HOT 4
- Running Toodles on a static file server HOT 2
- vscode HOT 1
- support chinese HOT 7
- Scarf OSX build has build-specific path HOT 4
- Scarf install on OSX does not work HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toodles.