Solutions to common issues when using T.
Problem: Flakes not enabled in Nix configuration.
Solution:
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.confFor NixOS users, add to
/etc/nixos/configuration.nix:
nix.settings.experimental-features = [ "nix-command" "flakes" ];Then rebuild:
sudo nixos-rebuild switchProblem: Your user is not in the Nix
trusted-users list, or the rstats-on-nix
binary cache is not configured.
Solution:
On NixOS, add to
/etc/nixos/configuration.nix:
nix.settings = {
trusted-users = [ "root" "your-username" ];
substituters = [
"https://cache.nixos.org"
"https://rstats-on-nix.cachix.org"
];
trustedPublicKeys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"rstats-on-nix.cachix.org-1:vdiiVgocg6WeJrODIqdprZRUrhi1JzhBnXv7aWI6+F0="
];
};Then rebuild: sudo nixos-rebuild switch
On non-NixOS Linux or macOS, add to
/etc/nix/nix.conf:
echo "trusted-users = root $(whoami)" | sudo tee -a /etc/nix/nix.conf
echo "substituters = https://cache.nixos.org https://rstats-on-nix.cachix.org" | sudo tee -a /etc/nix/nix.conf
echo "trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= rstats-on-nix.cachix.org-1:vdiiVgocg6WeJrODIqdprZRUrhi1JzhBnXv7aWI6+F0=" | sudo tee -a /etc/nix/nix.confThen restart the Nix daemon:
sudo systemctl restart nix-daemon (Linux) or
sudo launchctl kickstart -k system/org.nixos.nix-daemon
(macOS).
See the Nix Installation Guide for detailed instructions.
Problem: Nix is building dependencies from source (first time).
Solution: Be patient. First build can take 10-30 minutes.
Monitor progress:
nix develop --show-traceSpeed up future builds: Nix caches everything in
/nix/store/.
Problem: Inside Nix shell, Arrow should be available. If not, flake may be broken.
Solution:
# Ensure you're in Nix shell
nix develop
# Verify Arrow is available
pkg-config --modversion arrow-glib
# Should output version number (e.g., 10.0.0)If still failing: Try updating flake:
nix flake update
nix developProblem: Not inside Nix development shell.
Solution:
nix develop
# Now dune should be availableProblem: Modules not compiled or dependency issue.
Solution:
dune clean
dune buildIf still failing: Check dune file
includes necessary modules.
Problem: Parser grammar has ambiguities.
Example output:
Warning: 2 shift/reduce conflicts
Solution (for contributors):
parser.mly for ambiguous rules%left,
%right)For users: Warnings are okay if parser works correctly. Errors must be fixed.
Problem: Variable or function doesn’t exist in current scope.
Solution: 1. Check spelling: prnt →
print 2. Check if variable was assigned 3. Check if
function is in standard library
Check available functions:
> type(print)
"Function"
> type(undefined_func)
Error(NameError: ...)
Problem: Incompatible types in operation.
Solution: Explicit conversion (if available):
-- Bad
"Age: " + 25
-- Error: Cannot add String and Int
-- Workaround: Convert explicitly with to_string() and join with str_join()
print(str_join(["Age: ", to_string(25)]))
Problem: Operation on NA without explicit handling.
Solution: Use na_rm = true:
-- Bad
mean([1, 2, NA, 4])
-- Good
mean([1, 2, NA, 4], na_rm = true)
Problem: Dividing by zero.
Solution: Guard condition:
-- Bad
x / y
-- Good
if (y == 0) 0.0 else x / y
-- Or use error recovery
(x / y) ?|> \(result) if (is_error(result)) 0.0 else result
Problem: Usually in Arrow FFI or native code.
Debugging:
# Run with valgrind
valgrind --leak-check=full dune exec src/repl.exeWorkaround: Avoid Arrow operations, use fallback:
-- May crash with large native DataFrames
df = read_csv("huge.csv")
-- Try smaller data or manual loading
Report: This is a bug. Please report with minimal reproducible example.
Problem: Silent evaluation (no
print).
Solution:
-- Expressions at top-level are printed
> 2 + 3
5
-- But assignments are not
> x = 10
10 -- (value shown but not detailed)
-- Use print for detailed output
> print(x)
10
Problem: Severe error or assertion failure.
Solution: Restart REPL. Check what caused the crash and report if reproducible.
Problem: Waiting for multiline completion or invalid syntax.
Solution:
(, {,
[Problem: CSV file doesn’t exist or wrong path.
Solution:
-- Bad (relative to unknown location)
df = read_csv("data.csv")
-- Good (absolute or known relative path)
df = read_csv("/home/user/project/data.csv")
-- Or check file exists first
ls data.csv # In shell
Problem: Arrow infers types from first rows.
Solution: Ensure data is consistent:
Workaround: Preprocess CSV externally or load as strings and convert.
Problem: Column names like "Growth%"
not accessible.
Solution: Use
clean_colnames = true:
df = read_csv("data.csv", clean_colnames = true)
-- "Growth%" becomes "growth_percent"
Problem: Alpha interpreter is slow, especially for large data.
Solutions: 1. Reduce data size: Filter early in pipeline 2. Use native Arrow operations when available 3. Chunk processing: Split large files
Example:
-- Slow: Load everything then filter
df = read_csv("huge.csv")
small = df |> filter($year == 2023)
-- Better: Filter during load (if supported) or filter immediately
df = read_csv("huge.csv")
small = df |> filter($year == 2023) -- Filter early
Problem: Loading large datasets exhausts RAM.
Solutions: 1. Use streaming (not
yet available) 2. Process in chunks (manually split
CSV) 3. Reduce data before loading:
bash # In shell, filter before loading grep "2023" huge.csv > subset.csv
Problem: Precision differences across platforms.
Example:
Expected: 2.333333333
Got: 2.333333334
Solution: This is acceptable if difference < 1e-6. Update test to allow tolerance.
Possible causes: 1. Floating-point precision 2. NA handling differences 3. Sorting order for ties
Solution: Check if differences are significant or just numerical noise.
Problem: Arrow libraries not in library path.
Solution: Use Nix shell (this shouldn’t happen):
nix developIf Nix fails, check flake.nix for macOS-specific
configuration.
Problem: File on Windows mount
(/mnt/c/...) instead of Linux filesystem.
Solution: Clone repository to Linux filesystem:
# Bad (Windows mount)
cd /mnt/c/Users/username/tlang
# Good (Linux filesystem)
cd ~/tlangModify eval.ml (for contributors):
let debug = ref true
let eval env expr =
if !debug then
Printf.eprintf "DEBUG: eval %s\n" (show_expr expr);
(* ... *)See what Nix is building:
nix develop --show-traceCheck Nix store:
ls /nix/store/ | grep arrow
ls /nix/store/ | grep ocamlNuclear option (removes all build artifacts):
dune clean
rm -rf _build
nix develop --command dune buildInclude:
Exact error message
Minimal code to reproduce
Your environment:
uname -a
nix --version
# Inside nix develop:
ocaml --version
dune --version
pkg-config --modversion arrow-glibStill stuck? Create a GitHub Issue with details!