The definitions added in #299 cause a regression in Prelude typechecking
performance. Until we sort out the performance, we'll keep these
definitions in the module `Cryptol::Extras`.
We're only using this package for 7.8 compatibility, which will end when
GHC 8.0 is released soon. For now, just limit to the older version to
avoid import errors.
This is to set up improvements to the cryptol-server, and therefore
pycryptol interface.
This patch also fixes a regression in pretty-printing output caused by a
previous error in fixity of the `<>` operator
This notably adds a `MonadBaseControl` instance for the `REPL` monad so
that we can catch asynchronous exceptions in the middle of `REPL`
computations. Since this is a generalization of Haskeline's exception
support, that orphan instance for the console executable is now in terms
of this new instance.
This removes the `self-contained` flag, since it is fine for all builds
to have the baked-in prelude as a last resort. Tinkerers can still
change the prelude as long as it's in the search path.
Also removes some unnecessary extra prelude loading by the Cryptol
server by means of a new command
The benchmark suite no longer uses the `iteSolver` option.
Added a dependency on `deepseq-generics` so that the `NFData` instances
work correctly in Stackage LTS 2. Versions of `deepseq` before 1.4 have
a default instance that amounts to WHNF rather than NF, so benchmarks
were being measured incorrectly.
Attempt to normalize equality constraints involving a single unification
variable into a form where that variable is alone on one side of the equation.
Applying this normalization before attempting to simplify goals seems to clean
up some cases that the solver wasn't able to deal with.
By moving `build-depends` under the `if flag(server)` check. The diff
is a little hard to read, because I did not change the indentation of
the dependencies. Thanks @elliottt for the fix!
once merged, we'll disable the build by default so we don't incur the
zeromq dependency, but it would be nice to eventually make the server
the core of all our clients
The intent here is to allow users to write expressions to disk without
copy and pasting the ASCII representation into some other system (ex: a
Haskell script) to perform the actual file write.
Use:
```
Cryptol> :write /tmp/foo "hello Cryptol!\n"
Cryptol> :!cat /tmp/foo
hello Cryptol!
Cryptol> let var = "Complex computation\n"
Cryptol> :write /tmp/foo var
Cryptol> :!cat /tmp/foo
Complex computation
Cryptol> let var = 32 : [32]
Cryptol> :write /tmp/foo var
Can not write expression of types other than [n][8]. Type was: [32]
```
Also: Tab completion for FileExprArg commands.
This is rather half-done. The actual completion should depend on if
the user is inputting the 1st or 2nd argument, but we can't really
determine that without live parsing which is probably a largish change.
Instead, we just assume the completion is wrt the expr, since the file
will likely be new and not be able to tab-complete in real uses.
- Move the stackage file so it's not on by default (will test with it on
Jenkins instead of all the time)
- Use CPP to remove unnecessary import warnings in 7.10
We accidentally forgot to merge the 2.2.2 changes back into master, but
since they were mostly temporary fixes pending SBV updates, this didn't
cause any problems. This commit is just to be tidy :)
- Move the stackage file so it's not on by default (will test with it on
Jenkins instead of all the time)
- Use CPP to remove unnecessary import warnings in 7.10
This helps with #18 and should also reduce the number of unnecessary
recompiles that were triggered by the Makefile and/or cabal. The cabal
build type is now Simple.
Most of the complication in the TH.hs module is due to the various
places the current git hash might be stored:
1. Detached HEAD: the hash is in `.git/HEAD`
2. On a branch or tag: the hash is in a file pointed to by `.git/HEAD`
in a location like `.git/refs/heads`
3. On a branch or tag but in a repository with packed refs: the hash is
in `.git/packed-refs`
These situations all arise under normal development workflows and on the
Jenkins build machines, but there might be further scenarios that cause
problems. The tradeoff seems worthwhile though as now projects that
build Cryptol as a dependency wind up having to rebuild Cryptol far less
frequently.
Many of our projects that depend on Cryptol break because we forgot to
drag along `Cryptol.cry` or it just can't work out where it is from the
perspective of the other executable.
There's now a new flag `self-contained` in `cryptol.cabal` that is on by
default that bakes the contents of the Prelude into the library, so that
it can be reproduced on demand.
This is really a hack at this point because the module system bakes in
the assumption that a module has an associated file path, so we actually
have to write the contents to a tmp file before reading them back
in. Let's do better than this in the future.
This option is disabled for targets in the Makefile because we want the
standalone interpreter to be using the distribution's `Cryptol.cry`.
Makefile now has two modes depending on whether PREFIX is set. If it's
not, we try to make the distribution as relocatable as possible, meaning
we don't rely on the baked-in-by-cabal data directory. If it is set, we
do use that path.
This involved:
- Moving a couple REPL modules into the Cryptol library hierarchy (those
that don't depend on console libraries)
- Splitting up the Makefile, which unfortunately resulted in a lot of
not-quite-duplication between the two Makefiles. Let's look into
better abstraction...
This commit brings the notebook into the rest of the distribution
infrastructure set up for cryptol. The main points are:
- new icryptol-kernel executable
- new icryptol shell script that wraps ipython and makes sure the
cryptol profile is set up
- Makefile target for friendly local testing (`make notebook`)
- moved example notebooks to examples subdirectory
Now, the notebook interface runs its own ZeroMQ interface using the
EasyKernel module that is now exported from IHaskell's underlying
ipython-kernel library. This eliminates the line protocol with the
Python wrapper, and it should work on Windows (though it is not tested
there).
Part of this involved making the REPL monad able to change the IO action
used to print strings.
Continuing issues and improvment possibilities are in the issue tracker
- see issue #75 for a starting point.
There's now a more sensible hierarchy of locations that Cryptol uses to
look for modules. By default, in order it looks for libraries in:
1. The directories specified in the CRYPTOLPATH environment variable
2. The current directory
3. The user data directory (something like `$HOME/.cryptol`)
4. Relative to the executable's install directory
5. The static path used when building the executable (cabal's data-dir)
There is also a new command-line flag for the interpreter:
`--cryptolpath-only` which makes the interpreter ignore locations 2-5.
This commit also reworks the Makefile and build/release process. These
are bunched together because they play off each other quite a bit; the
build/release process determines the location of the `Cryptol.cry`,
which must be found when looking for modules.
Rather than leaning on `cabal install`, we now use a combination of
`cabal configure`, `cabal build`, and `cabal copy`. A couple of upshots
to this:
- More of the release staging is handled by cabal -- we don't have to go
in and manually copy things out of the sandbox. In fact, the `cryptol`
executable never goes into the sandbox.
- The testing infrastructure runs on executables that are in place in
the staging directory, rather than in the sandbox. This should be more
hygienic and realistic.
- The `Cryptol.cry` prelude file is now in `/share/cryptol` in order to
better reflect the common POSIX structure. This means Cryptol will
play nicer in global installs, and mirrors what other interpreted
languages do.
- The default build settings use a prefix of `/usr/local` rather than
using the sandbox directory. This makes them more relocatable for
binary distributions. Set PREFIX= before making to change this.