For a complete list of the options available use the --help
flag.
Required tools:
stack
https://haskellstack.org
- Clone the repository
git clone https://github.com/ohua-dev/condrust
- Build the program
stack install
This downloads and builds all dependencies, as well as the Haskell compiler
ghc
, should it not be present already. It should not interfere with any
system-level libraries, Haskell ecosystems etc.
It builds the executable condrust
and copies it to ~/.local/bin
. If you do
not wish this use stack build
instead and find the path of the binary using
stack exec -- which condrust
afterwards
Check out the test cases in the test
folder for our existing integrations.
You may run individual test cases using stack like so:
stack test --ta '--match "/Rust Integration/TailRec/contexted function/"'
Also, we do run our CI based on Nix. For development, you may want to build and run tests without Nix. You can do so via
stack build --no-nix
stack test --no-nix
You can read up on it in the (section on Nix integration of the stack documentation)[https://docs.haskellstack.org/en/stable/nix_integration/].
The official, verbose documentation is on readthedocs.
In addition many of the parts of the compiler library are documented with the documentation tool haddock.
To get a browsable documentation locally use stack hoogle -- serve --local
.
This will build the documentation for both the core, as well as its
dependencies and start a server locally on port 8080
. There you can search for
functions, types, modules and libraries and browse their documentation.
The default formatting for code is done using the hindent
library, the
configuration file .hindent.yaml
can be found at the project root.
I use a Prelude
replacement called Universum
in this project. This has a few
minor consequences for how code is written. Most importantly I activate the
NoImplicitPrelude
extension by default. This means you have to import a
prelude explicitly.
- You can use
Ohua.Commons.Prelude
which pulls inUniversum
as well as basic ohua core modules (Ohua.Types
,Ohua.Commons.Util
) and code traversal helpers such astransform
andrewrite
. - Alternatively you can import
Universum
- or
Prelude
if you really likePrelude
).
The following are some notes on using Universum
, assembled for your convenience:
-
Be very careful when using
[]
in your code.If your module also includes
NonEmpty
then this will always result in a runtime error! The reason for that is because we have theOverloadedLists
extension enabled andNonEmpty
implements an instance ofIsList
. So[]
desugars intoNE.fromList []
which will always fail! -
error
fromUniversum
usesText
rather thanString
This should not be an issue, most value we manipulate in this library are
Text
anyways. -
Trace functions (
trace
,traceShowId
etc) are in scope by default, but raise a warning.Aka you can use them, but you have to remove them if you want the code to pass the CI.
-
Universum uses
Text
rather thanString
by default.Aka use
<>
(also in scope by default) rather than++
to concatenate strings. -
some IO is polymorphic
putStrLn "some string"
will raise an ambiguity error, you'll have to annotate the string like soputStrLn ("some string" :: Text)
-
mtl
stuff is in scope by default.The
Reader
,ExceptT
andState
monad (+ transformers, + classes) are in scope by default. No need to importControl.Monad.Reader
etc
For more information on universum check out the GitHUb repository.