- Notifications
You must be signed in to change notification settings - Fork1
A Haskell study starter kit
License
vanfp/study
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a starter project set up for testing and benchmarking. Happy hacking!
Download dependencies, build your library and compile executable.
The dependency part may take a while ☕🚶♀️
> stack buildstudy-0.1.0: configure (lib + exe)# ...Registering study-0.1.0...
There isno need to runstack install
, unless you want your app copied to~/.local/bin
so that it can be called from anywhere as a regular binary.
To override the configured GHC options, (ex. GHC optimizations), use--ghc-opts
:
> stack build --ghc-options=-O2# ...Registering libraryfor study-0.1.0..
> stackexec studyHello World
Drop into aghci
session with your project preloaded.
> stack replstudy-0.1.0: configure (lib + exe)# ...Ok, modules loaded: Main, Study.*Main Study> hello"Hello World"*Main Study> :q# Exit REPL
> stacktest# ...study-0.1.0:test (suite: study-doctest)# DoctestsExamples: 5 Tried: 5 Errors: 0 Failures: 0 Failures: 0study-0.1.0: Test suite study-doctest passedstudy-0.1.0:test (suite: study-test)# Unit testsAll 0 tests passed (0.00s)study-0.1.0: Test suite study-test passedCompleted 2 action(s).
Configured for both unit test and doctests.Please note that the doctest output isnot colourized.
To open the HTML docs only for your library:
> stack haddock study --open
To open HTML docs foreverything in your project, including dependencies:
> stack haddock --open
This project is configured for simple benchmarking.
> stack bench# ...time 26.97 ns (23.35 ns .. 31.92 ns) 0.871 R² (0.834 R² .. 0.924 R²)mean 30.12 ns (27.12 ns .. 34.06 ns)std dev 10.84 ns (8.861 ns .. 13.56 ns)variance introduced by outliers: 100% (severely inflated)Benchmark study-benchmarks: FINISHCompleted 2 action(s).
Critereon is included as a dependency.If you would like to do some more traditional microbenching, start in/benchmark/Main.hs
You can go much deeper, but that's out of scope for what we'll be covering.