[ANN] Pinpointer: yet another spec error reporter

2017-12-11 Thread OHTA Shogo
Hi, all

I’m happy to announce the first release of Pinpointer, yet another 
implementation of spec error reporter based on a precise error analysis.

- https://github.com/athos/Pinpointer

Pinpointer provides functionalities very similar to the existing spec error 
reporters (eg. Expound[1], Inspectable[2] etc.), that is, reporting spec 
errors in a more human-readable way.

[1] https://github.com/bhb/expound
[2] https://github.com/jpmonettas/inspectable

Unlike those libraries, which analyze spec errors using several heuristics, 
Pinpointer performs a systematic error analysis traversing a pair of the 
spec and the input. This makes it possible to report the error even in 
complicated cases where s/conformer would transform the input value, like 
the following:

=> (require '[pinpointer.core :as p] '[clojure.spec.alpha :as s])
=> (p/pinpointer (s/and string? (s/conformer seq) (s/* #{\a})) "aabaa")
Detected 1 spec error:
--
(1/1)


Cause: (\a \a \b \a \a)
  ^^   
 Expected: #{\a}


   --- This comes originally from ---


 Original: "aabaa"
   ^^^
 Spec
  Applied: (s/and string? (s/conformer seq) (s/* #{\a}))


--
nil
user=>


(BTW the above example is just a demo for Pinpointer's capability, and it 
doesn't mean to encourage you to write specs like that.)

On the other hand, one of the downsides of the library is that Pinpointer 
has to know in advance the behaviors of the spec macros involved in a spec 
form for its error analysis. Note also that, Pinpointer occasionally uses  
eval under the hood (at least for now), so it’s basically intended to be 
used for development purpose only.

I hope you’ll like it :)

Thanks,
Shogo

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Pinpointer: yet another spec error reporter

2017-12-11 Thread Ben Brinckerhoff

Very cool! Excellent work.


On Monday, December 11, 2017 at 7:23:38 AM UTC-7, OHTA Shogo wrote:
>
> Hi, all
>
> I’m happy to announce the first release of Pinpointer, yet another 
> implementation of spec error reporter based on a precise error analysis.
>
> - https://github.com/athos/Pinpointer
>
> Pinpointer provides functionalities very similar to the existing spec 
> error reporters (eg. Expound[1], Inspectable[2] etc.), that is, reporting 
> spec errors in a more human-readable way.
>
> [1] https://github.com/bhb/expound
> [2] https://github.com/jpmonettas/inspectable
>
> Unlike those libraries, which analyze spec errors using several 
> heuristics, Pinpointer performs a systematic error analysis traversing a 
> pair of the spec and the input. This makes it possible to report the error 
> even in complicated cases where s/conformer would transform the input 
> value, like the following:
>
> => (require '[pinpointer.core :as p] '[clojure.spec.alpha :as s])
> => (p/pinpointer (s/and string? (s/conformer seq) (s/* #{\a})) "aabaa")
> Detected 1 spec error:
> --
> (1/1)
>
>
> Cause: (\a \a \b \a \a)
>   ^^   
>  Expected: #{\a}
>
>
>--- This comes originally from ---
>
>
>  Original: "aabaa"
>^^^
>  Spec
>   Applied: (s/and string? (s/conformer seq) (s/* #{\a}))
>
>
> --
> nil
> user=>
>
>
> (BTW the above example is just a demo for Pinpointer's capability, and it 
> doesn't mean to encourage you to write specs like that.)
>
> On the other hand, one of the downsides of the library is that Pinpointer 
> has to know in advance the behaviors of the spec macros involved in a spec 
> form for its error analysis. Note also that, Pinpointer occasionally uses  
> eval under the hood (at least for now), so it’s basically intended to be 
> used for development purpose only.
>
> I hope you’ll like it :)
>
> Thanks,
> Shogo
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.