Comments (3)
As small as an example as I can manage:
var db = database "stefan";
var exists = compose(not, empty);
typename Data = (parent : Int, value : String);
typename CompilationContext = TableHandle(Data,Data,Data);
sig filterConstraint : (CompilationContext) ~> (Data) -> Bool
fun filterConstraint (data) {
var aa = fun (x) {
for (text <-- data)
where ( true )
[(val = text.value)]
};
fun (x) {
exists(
for (a <- aa(x))
where (a.val == "b")
[()]
)
}
}
var data = table ("ciawfb_data") with Data from db;
var filter = filterConstraint(data);
query {
for (r <-- data)
where (filter(r))
[r]
}
Replacing sig filterConstraint : (CompilationContext) ~> (Data) -> Bool
by sig filterConstraint : (CompilationContext) ~> (Data) {}-> Bool
"fixes" the problem.
from links.
Here's a smaller example:
var exists = compose(not, empty);
sig filterConstraint : () -> Bool
fun filterConstraint () {
exists([()])
}
query {
[(x=filterConstraint())]
}
There is a bug in Links in the way it is reporting the bug in your program. The bug in your program is that due to the ML value restriction, exists is not polymorphic in its effects, but filterConstraint is declared to have a type that is polymorphic in its effects. The solution is to eta expand exists:
fun exists(xs) {not(empty(xs))}
or:
var exists = fun (xs) {compose(not, empty)(xs)};
In fact, we could, and perhaps should relax the value restriction in the case of pure functions (like compose, pure, and empty), in which case your original program would work.
from links.
Thanks, I fixed my code :-)
Now I'll have to do some reading on the value restriction.
from links.
Related Issues (20)
- Error when calling non-closed local server functions HOT 7
- Unbound effect variables in type aliases when effect sugar is enabled
- Incorrect resolution of shadowed names in mutual blocks HOT 2
- "flat" and "nested" kinds for query results
- Lens refactor HOT 2
- Kind inference
- dateToInt -> intToDate does not roundtrip depending on time zone HOT 3
- Interaction between session-typed communication and effects is broken even without multi-shot continuations
- Incomplete rows can trigger an internal error
- Some questions about your work :) HOT 3
- REPL prompt disappears HOT 5
- "opam install links" doesn't produce linx executable in Ocaml 5.0.0 HOT 8
- Restriction of using row polymorphism for the effect system
- Recent versions of ppx_sexp_conv cause warnings in lens code
- Untypesettable session types
- Implement delegatable channels
- Rename links-mysql8 driver to links-mysql? HOT 2
- SPARQL improvements
- ppx_sexp_conv creates code triggering warning 40 HOT 3
- Incompatible with OCaml 4.08 HOT 2
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 links.