Comments (3)
In such situations, it's always a good idea to define a default phrase which simply returns the problem:
(defphraser :default
[_ problem]
problem)
with that, (phrase/phrase-first {} ::coll-of-ints [:a])
returns:
{:path [],
:pred int?,
:val :a,
:via [:grape/coll-of-ints],
:in [0],
:phrase.alpha/mappings {},
:phrase.alpha/via ()}
here you can see that the :pred
is only int?
without a namespace. Your phraser on the other hand is registered with the predicate clojure.core/int?
. Thats not the same.
Here we have a spec bug. Spec should use clojure.core/int?
as predicted and not simply int?
. They used to use simple symbols of press everywhere in the past. I thing they just forgot to add the namespace here.
A workaround is to use a registered spec like your ::just-int
in s/coll-of
like so:
(s/def ::coll-of-ints (s/coll-of ::just-int))
I'll look for an existing or open an issue in the Clojure JIRA. This issue stays open until upstream is fixed.
from phrase.
The following upstream issue applies: https://dev.clojure.org/jira/browse/CLJ-2168
from phrase.
Thanks @alexanderkiel, I appreciate your detailed explanation!
from phrase.
Related Issues (20)
- Update ClojureScript to Support Java 9 HOT 1
- doesn't seem to work with spec/merge HOT 3
- Should we have a phrase-all function? HOT 6
- Is there any way to remove/clear phrases? HOT 2
- Add required keys phraser example to README? HOT 2
- Confusing difference between s/explain and phrase on success HOT 2
- Binding pred HOT 2
- Test on more JDK's
- defphrase not matching set parameter HOT 1
- Ensure that Examples in README work in a ClojureScript REPL
- Fail to match coll-of min-count predicate HOT 1
- Simple or not doable??? HOT 5
- Fail to match distinct? predicate HOT 1
- Phrasing (s/int-in min max) HOT 1
- Please define phrase-all like so: HOT 1
- Fix Form Resolution Problem in Self-Hosted ClojureScript HOT 1
- phrasing error in recursive s/cat HOT 3
- Binding to clojure symbols fails HOT 1
- Capture Binding Symbols Should Shadow Global Symbols in Predicates
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 phrase.