Welcome! Please see the About page for a little more info on how this works.

0 votes
in Spec by

I came across a couple of (minor) hurdles to trying out spec-alpha2. They were both down to the documentation on the GitHub page. The namespaces quoted are for the previous version of spec and the jar file is not in one of Leiningen's default repositories.

I suggest updating as below:

Change the "Namespaces to load:" section to quote clojure.spec-alpha2 rather than clojure.alpha.spec

In the section with Maven coordinates mention that the jars are in the Sonatype snapshots repository (https://oss.sonatype.org/content/repositories/snapshots/)

1 Answer

0 votes

The namespaces are correct (the previous version is clojure.spec.alpha, the spec-alpha2 version is clojure.alpha.spec for now, presumably will be clojure.spec though by the time it's released).

We do not believe this lib is ready to use yet (it is incomplete and has a number of known bugs). The sonatype snapshots repository is mentioned in the releases section (link for Development Snapshot Versions). We are not currently doing snapshot releases. There may be something out there from testing the build box job but it doesn't reflect current state or anything I would recommend using. Maybe I'll just remove all that for now.

As the readme says, if you want to try it during development, use it as a git dep to get the current state.

I think removing the reference  to maven builds would be a good idea in case anyone else goes down the rabbit hole I went into, maybe even pull from the repo if possible.

After some detective work I got this to work (which I guess is from the very early days of spec-alpha2)

(defproject scratch "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.10.1"]
                 [org.clojure/spec-alpha2 "0.2.177-SNAPSHOT"]
                 [org.clojure/test.check "0.9.0"]]
  :repositories [["sonatype" {:url "https://oss.sonatype.org/content/repositories/snapshots/"}]])

(ns scratch.core
  (:require [clojure.spec-alpha2 :as sa2]
            [clojure.spec-alpha2.gen :as gen]))

(sa2/def ::x (s/and-
            (s/cat :i1 int? :i2 int?)
            #(apply distinct? %)))

etc etc
Well just fyi, whatever that snapshot is, it's old and does not reflect the current state of the repo.