Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
3bd72fe
remove all
ingun37 Sep 6, 2025
d99493a
genesis
ingun37 Sep 6, 2025
0d5b858
basic cli
ingun37 Sep 6, 2025
8fd6ba8
reading directory and very basic test data
ingun37 Sep 6, 2025
9f42157
text and filetype
ingun37 Sep 7, 2025
d846343
trying to compile cmark ...
ingun37 Sep 7, 2025
f9ac298
convert to tree
ingun37 Sep 7, 2025
92d3300
tree folding
ingun37 Sep 8, 2025
9aa3214
pass down full path, hash
ingun37 Sep 8, 2025
4421732
refac
ingun37 Sep 8, 2025
5cbe1b0
remove numAnswer and hash
ingun37 Sep 8, 2025
0971b32
copy resource
ingun37 Sep 8, 2025
61e11d6
hmmm
ingun37 Sep 8, 2025
1cef2c6
log
ingun37 Sep 8, 2025
a3eaa72
format
ingun37 Sep 8, 2025
197de7f
cabal project
ingun37 Sep 9, 2025
128fb1c
Revert "cabal project"
ingun37 Sep 9, 2025
9b2633d
finally it builds
ingun37 Sep 9, 2025
7934061
construct time map
ingun37 Sep 10, 2025
dd72664
refact
ingun37 Sep 10, 2025
ee70b82
refact
ingun37 Sep 10, 2025
bfd9a07
refact
ingun37 Sep 10, 2025
c674a71
compile markdown
ingun37 Sep 10, 2025
9311e09
data flow readme
ingun37 Sep 10, 2025
503b734
test with git submodule
ingun37 Sep 10, 2025
199fb58
unpack bytestring correctly
ingun37 Sep 10, 2025
8a0dcfb
time
ingun37 Sep 10, 2025
508abcb
refact
ingun37 Sep 10, 2025
db2bf36
write json files
ingun37 Sep 10, 2025
f43cc76
parent hash
ingun37 Sep 10, 2025
b213a72
page content
ingun37 Sep 10, 2025
84877ee
qualified import in MyGit.hs
ingun37 Sep 10, 2025
7cc0a2b
pretty log
ingun37 Sep 10, 2025
8be01e3
cool lens tricks
ingun37 Sep 10, 2025
def2fa0
prefix
ingun37 Sep 11, 2025
7b3dc00
distinguish code and math
ingun37 Sep 11, 2025
d78b682
new line
ingun37 Sep 11, 2025
7604d74
workflow
ingun37 Sep 11, 2025
f2ff100
git add flake.nix
ingun37 Sep 11, 2025
d1f9b2d
update cache.iog
ingun37 Sep 11, 2025
d826468
fix ghc version
ingun37 Sep 11, 2025
ff316d6
lets gooo
ingun37 Sep 11, 2025
fe1097a
pause ...
ingun37 Sep 11, 2025
7869607
ghc version 9121
ingun37 Sep 11, 2025
93ad8e2
use flake
ingun37 Sep 11, 2025
f32fbe8
ditch haskell.nix
ingun37 Sep 11, 2025
cd69d35
give it a try another
ingun37 Sep 11, 2025
086c511
try again
ingun37 Sep 11, 2025
d303db8
another hix go
ingun37 Sep 11, 2025
2bfa922
add flake.nix
ingun37 Sep 11, 2025
73b163a
allow-import-from-derivation
ingun37 Sep 11, 2025
051f6c8
accept-flake-config
ingun37 Sep 11, 2025
e73d526
shaaaaa
ingun37 Sep 11, 2025
1d9bc22
buffer size
ingun37 Sep 11, 2025
46c0fc2
cat
ingun37 Sep 11, 2025
86abfdf
fix flake.nix
ingun37 Sep 11, 2025
c9638b1
remove sha1
ingun37 Sep 11, 2025
ae7d7a5
back
ingun37 Sep 11, 2025
04850e8
try different sha
ingun37 Sep 11, 2025
bfc01af
correct sha
ingun37 Sep 11, 2025
dc4f528
how to check sha256
ingun37 Sep 11, 2025
ca5187c
ghc 9 12 2
ingun37 Sep 11, 2025
bf6fea9
prefixpath --> prefix
ingun37 Sep 11, 2025
9e2fe83
fix image prefix
ingun37 Sep 11, 2025
dee47cc
up version to 1.0.0.0
ingun37 Sep 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build & cache
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://cache.iog.io/ https://cache.nixos.org/
allow-import-from-derivation = true
accept-flake-config = true
download-buffer-size = 524288000
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v15
with:
name: inguncache
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- run: |
# nix run "github:input-output-hk/haskell.nix#hix" -- init
# echo "------ Content of flake.nix ------"
# cat flake.nix
# echo "----- Content of nix/hix.nix -----"
# cat nix/hix.nix
nix build .#answers-script:exe:answers-script
88 changes: 3 additions & 85 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,85 +1,3 @@
.cabal-sandbox/
cabal.sandbox.config
cabal.project.local
.ghc.environment.*
cabal-dev/
.hpc/
*.hi
*.o
*.p_hi
*.prof
*.tix
dist
dist-*
register.sh
./cabal.config
cabal-tests.log
bootstrap/*.plan.json

/Cabal/dist/
/Cabal/tests/Setup
/Cabal/Setup
/Cabal/source-file-list

/cabal-install/dist/
/cabal-install/Setup
/cabal-install/source-file-list

.stylish-haskell.yaml
.stylish-haskell.yml
.ghci
.ghcid

# Output of release and bootstrap
_build

# editor temp files

*#
.#*
*~
.*.swp
*.bak

# GHC build

Cabal/GNUmakefile
Cabal/dist-boot/
Cabal/dist-install/
Cabal/ghc.mk


# TAGS files
TAGS
tags
ctags

# stack artifacts
/.stack-work/
stack.yaml.lock

# Shake artifacts
.shake*
progress.txt

# test files
register.sh

# windows test artifacts
cabal-testsuite/**/*.exe
cabal-testsuite/**/*.bat

# python artifacts from documentation builds
*.pyc
.python-sphinx-virtualenv/
/doc/.skjold_cache/

# macOS folder metadata
.DS_Store

# benchmarks
bench.html

# Emacs
.projectile
/test/dst/
/dist-newstyle
/test/dst
/cabal.project.freeze
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "test/answers-db"]
path = test/answers-db
url = https://github.com/ingun37/answers-db.git
branch = test-data
File renamed without changes.
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Copyright (c) 2025, Ingun Jon


Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
87 changes: 57 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,72 @@
# Answers Script
# Build MacOS

## Generate default.nix
```sh
# for building gitlib packages
brew install pkgconf
brew install icu4c
brew install openssl@3

```shell
nix-shell -p cabal2nix
cabal2nix --no-check ./. > default.nix
```

## Generate shell.nix
# /usr/local/opt/openssl is hard coded in the gitlib build setting.
ln -s $(brew --prefix openssl@3)/3.5.2 /usr/local/opt/openssl

```shell
nix-shell -p cabal2nix
cabal2nix --shell --no-check ./. > shell.nix
echo "export PKG_CONFIG_PATH=\"$(brew --prefix)/opt/icu4c/lib/pkgconfig\"" >> ~/.zprofile
```

## Build
```sh
cabal build
```

**Don't just build using Cabal!!** it will take forever because of Pandoc.
# Data flow

Build in Nix environment
```mermaid
flowchart LR
n1["src"] --> n2(("directory-tree<br>readDirectoryWithL"))
n3["myReader"] --> n2
n2 --> n4["AnchoredDirTree FileType"]
n4 --> n5(("directory-tree<br>filterDir"))
n5 --> n8(("unfoldTree"))
n9["myUnfolder"] --> n8
n8 --> n10["Tree Item"]
n11["myFilter"] --> n5
n10 --> n12(("recurse"))
n13["myWriter"] --> n12
n12 --> n14["[Effect]"]

```shell
# Enter Nix environment defined in shell.nix
nix-shell
# Use executable
answers-script ...
n1@{ shape: rect}
n9@{ shape: rect}
```

## Test
# CI/CD

```shell
nix-shell
cabal --enable-nix test
Check the sha1 of gitlib like this

```sh
nix-shell -p nix-prefetch-git
nix-prefetch-git https://github.com/jwiegley/gitlib.git bf256617179d853bdbc12e9283b3f570ebb9d9d7 --fetch-submodules
```

## Install from other machines
Output is like

```shell
TAR="https://github.com/ingun37/answers-script/archive/refs/tags/1.0.1.tar.gz"
# sandboxing
nix-shell -p "with import <nixpkgs> {}; let f = import (fetchTarball $TAR); in haskellPackages.callPackage f {}"
# no sandboxing
nix-env --install -E "with import <nixpkgs> {}; let f = import (fetchTarball $TAR); in _: (haskellPackages.callPackage f {})"
```
git revision is bf256617179d853bdbc12e9283b3f570ebb9d9d7
path is /nix/store/63bx4k5nwjqwk7gv0a0k8adq796bjbpr-gitlib-bf25661
git human-readable version is -- none --
Commit date is 2025-09-04 11:17:27 -0700
hash is 13k3aymqwzpcijnjjka820nv6rkgakzbvh13glw98p1c4yhqwcbf
{
"url": "https://github.com/jwiegley/gitlib.git",
"rev": "bf256617179d853bdbc12e9283b3f570ebb9d9d7",
"date": "2025-09-04T11:17:27-07:00",
"path": "/nix/store/63bx4k5nwjqwk7gv0a0k8adq796bjbpr-gitlib-bf25661",
"sha256": "13k3aymqwzpcijnjjka820nv6rkgakzbvh13glw98p1c4yhqwcbf",
"hash": "sha256-bjGOoScsXJQ4fSPAvf5Ub2azLRBITSmtjOx+jqtXY44=",
"fetchLFS": false,
"fetchSubmodules": true,
"deepClone": false,
"fetchTags": false,
"leaveDotGit": false,
"rootDir": ""
}
```

Use the "sha256" for the `--sha256` field in the `cabal.project`.
Loading
Loading