Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ fix #1743 ] move README to doc/ directory #2184

Merged
merged 12 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions .github/workflows/ci-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ env:
CABAL_VERSION: 3.6.2.0
CABAL_INSTALL: cabal v1-install --ghc-options='-O1 +RTS -M6G -RTS'
# CABAL_INSTALL: cabal install --overwrite-policy=always --ghc-options='-O1 +RTS -M6G -RTS'
AGDA: agda -Werror +RTS -M3.5G -H3.5G -A128M -RTS -i. -i src/
AGDA: agda -Werror +RTS -M3.5G -H3.5G -A128M -RTS -i. -isrc -idoc

jobs:
test-stdlib:
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
- name: Test stdlib
run: |
cabal run GenerateEverything
cp travis/* .
cp .github/tooling/* .
./index.sh
${{ env.AGDA }} --safe EverythingSafe.agda
${{ env.AGDA }} index.agda
Expand All @@ -178,7 +178,7 @@ jobs:
rm -f '${{ env.AGDA_HTML_DIR }}'/*.css
${{ env.AGDA }} --html --html-dir ${{ env.AGDA_HTML_DIR }} index.agda

cp travis/* .
cp .github/tooling/* .
./landing.sh

- name: Deploy HTML
Expand Down
10 changes: 7 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,27 @@ AGDA=$(AGDA_EXEC) $(AGDA_OPTIONS) $(AGDA_RTS_OPTIONS)
# cabal install fix-whitespace

test: Everything.agda check-whitespace
$(AGDA) -i. -isrc README.agda
cd doc && $(AGDA) README.agda

testsuite:
$(MAKE) -C tests test AGDA="$(AGDA)" AGDA_EXEC="$(AGDA_EXEC)" only=$(only)

fix-whitespace:
cabal exec -- fix-whitespace

check-whitespace:
cabal exec -- fix-whitespace --check

setup: Everything.agda

.PHONY: Everything.agda
Everything.agda:
cabal run GenerateEverything
cabal run GenerateEverything -- --out-dir doc
jamesmckinna marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: listings
listings: Everything.agda
$(AGDA) -i. -isrc --html README.agda -v0
cd doc && $(AGDA) --html README.agda -v0

clean :
find . -type f -name '*.agdai' -delete
rm -f Everything.agda EverythingSafe.agda
37 changes: 30 additions & 7 deletions GenerateEverything.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RecordWildCards #-}

import Control.Applicative
import Control.Monad
Expand Down Expand Up @@ -299,18 +300,37 @@ checkFilePaths cat fps = forM_ fps $ \ fp -> do
unless b $
die $ fp ++ " is listed as " ++ cat ++ " but does not exist."

data Options = Options
{ includeDeprecated :: Bool
, outputDirectory :: FilePath
}

initOptions :: Options
initOptions = Options
{ includeDeprecated = False
, outputDirectory = "."
}

parseOptions :: [String] -> Options -> Maybe Options
parseOptions [] opts = pure opts
parseOptions ("--include-deprecated" : rest) opts
= parseOptions rest (opts { includeDeprecated = True })
parseOptions ("--out-dir" : dir : rest) opts
= parseOptions rest (opts { outputDirectory = dir })
parseOptions _ _ = Nothing

---------------------------------------------------------------------------
-- Collecting all non-Core library files, analysing them and generating
-- 4 files:
-- 2 files:
-- Everything.agda all the modules
-- EverythingSafe.agda all the safe modules

main :: IO ()
main = do
args <- getArgs
includeDeprecated <- case args of
[] -> return False
["--include-deprecated"] -> return True
_ -> hPutStr stderr usage >> exitFailure
Options{..} <- case parseOptions args initOptions of
Just opts -> pure opts
Nothing -> hPutStr stderr usage >> exitFailure

checkFilePaths "unsafe" unsafeModules
checkFilePaths "using K" withKModules
Expand All @@ -325,14 +345,14 @@ main = do

let mkModule str = "module " ++ str ++ " where"

writeFileUTF8 (allOutputFile ++ ".agda") $
writeFileUTF8 (outputDirectory ++ "/" ++ allOutputFile ++ ".agda") $
unlines [ header
, "{-# OPTIONS --rewriting --guardedness --sized-types #-}\n"
, mkModule allOutputFile
, format libraryfiles
]

writeFileUTF8 (safeOutputFile ++ ".agda") $
writeFileUTF8 (outputDirectory ++ "/" ++ safeOutputFile ++ ".agda") $
unlines [ header
, "{-# OPTIONS --safe --guardedness #-}\n"
, mkModule safeOutputFile
Expand All @@ -353,6 +373,9 @@ usage = unlines
, "The program generates documentation for the library by extracting"
, "headers from library modules. The output is written to " ++ allOutputFile
, "with the file " ++ headerFile ++ " inserted verbatim at the beginning."
, ""
, "If the option --out-dir is used then the output is placed in the"
, "subdirectory thus selected."
]


Expand Down
25 changes: 8 additions & 17 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,23 +244,14 @@ you are never committing anything with a whitespace violation:
Type-checking the README directory
----------------------------------

* By default the README directory is not exported in the
`standard-library.agda-lib` file in order to avoid clashing with other people's
README files. This means that by default type-checking a file in the README
directory fails.

* If you wish to type-check a README file, then you will need to change the line:
```
include: src
```
to
```
include: src .
```
in the `standard-library.agda-lib` file.

* Please do not include this change in your pull request.

* By default the README files are not exported in the
`standard-library.agda-lib` file in order to avoid
clashing with other people's README files.

* If you wish to type-check a README file, then you will
need to change the present working directory to `doc/`
Copy link
Contributor

@jamesmckinna jamesmckinna Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I've been thinking a lot (if not 'hard') about this, and I don't know if it makes more, or less, sense, to have the README.* modules in a doc directory, or in good-old README as a top-level directory, and simply bump all the modules names 'up' one level, by having what would then be README.agda import from Axiom rather than README.Axiom etc.

Alternatively, leave the entire existing README/ directory alone, but simply have its blah.agda-lib point at... the right directories (and here is where I get confused about what those should be... . ../src as already, or . ./README ../src (I guess this latter is subsumed by the former?)

In other words, the change could be less invasive still simply by moving toplevel README.agda to README/, and updating the GNUmakefile and .github/tooling scripts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many modules in README have identical paths as the modules from the standard library (e.g. README/Function/Reasoning.agda and src/Function/Reasoning.agda, README/Data/List.agda and src/Data/List.agda, etc.). If the README. prefix in the module paths is removed, I wonder how Agda resolves the module?

Copy link
Contributor

@jamesmckinna jamesmckinna Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think because the include directive line will ensure that those in doc/README will get searched for before trying to look for them in src?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The include in this PR looks good to me. What I don't understand is how your alternative approach works. (this one:

... in good-old README as a top-level directory, and simply bump all the modules names 'up' one level, by having what would then be README.agda import from Axiom rather than README.Axiom etc.

Alternatively, leave the entire existing README/ directory alone, but simply have its blah.agda-lib point at... the right directories (and here is where I get confused about what those should be... . ../src as already, or . ./README ../src (I guess this latter is subsumed by the former?)

I might be wrong, but including ../README directory before ../src in include: sounds like modules in README will shadow those that have the same name in src. Without the README. prefix in the module paths, how could files like README.Data.List.Relation.Binary.Equality that import Data.Nat continue to work? Wouldn't Data.Nat incorrectly refers to README.Data.Nat?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah... ok, perhaps you're right.

In any case, I would prefer simply to have the doc directory be called README instead. Or are you saying that such a solution also would not work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that should work.

where an appropriate `standard-library-doc.agda-lib`
file is present.

Continuous Integration (CI)
===========================
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Travis (.org) branch](https://img.shields.io/travis/agda/agda-stdlib/master?label=master)
![Travis (.org) branch](https://img.shields.io/travis/agda/agda-stdlib/experimental?label=experimental)
[![Ubuntu build](https://github.com/agda/agda-stdlib/actions/workflows/ci-ubuntu.yml/badge.svg)](https://github.com/agda/agda-stdlib/actions/workflows/ci-ubuntu.yml)

[![Ubuntu build](https://github.com/agda/agda-stdlib/actions/workflows/ci-ubuntu.yml/badge.svg?branch=experimental)](https://github.com/agda/agda-stdlib/actions/workflows/ci-ubuntu.yml)

The Agda standard library
=========================
Expand Down
1 change: 1 addition & 0 deletions dev/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
4 changes: 4 additions & 0 deletions dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Development playground

This directory allows you to develop modules against the current dev
version of the stdlib as it currently sits in `src/`.
4 changes: 4 additions & 0 deletions dev/experimental.agda-lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: standard-library-dev
include: . ../src
flags:
--warning=noUnsupportedIndexedMatch
jamesmckinna marked this conversation as resolved.
Show resolved Hide resolved
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ record Semigroup : Set (suc (a ⊔ ℓ)) where
-- IsA A
-- / || \ / || \
-- IsB IsC IsD B C D

-- The procedure for re-exports in the bundles is as follows:

-- 1. `open IsA isA public using (IsC, M)` where `M` is everything
Expand All @@ -280,7 +280,7 @@ record Semigroup : Set (suc (a ⊔ ℓ)) where

-- 5. `open B b public using (O)` where `O` is everything exported
-- by `B` but not exported by `IsA`.

-- 6. Construct `d : D` via the `isC` obtained in step 1.

-- 7. `open D d public using (P)` where `P` is everything exported
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions doc/standard-library-doc.agda-lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: standard-library-doc
include: . ../src
flags:
--warning=noUnsupportedIndexedMatch
1 change: 0 additions & 1 deletion fix-whitespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ included-dirs:
included-files:
- "*.agda"
- "*.md"
- ".travis.yml"

excluded-files:
- "README/Text/Tabular.agda"
Expand Down
12 changes: 2 additions & 10 deletions notes/release-guide.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,12 @@ procedure should be followed:
* Announce the release of the new version on the Agda mailing lists
(users and developers).

* Add v$VERSION to the list of protected directories in the .travis.yml
file of BOTH master and experimental. They should look something like:

> git checkout HEAD -- v0.16/ v0.17/ v1.0/ v1.1/ (...)

Commit & push these changes. This will prevent the next step from being
overwritten by travis.

* Generate and upload documentation for the released version:

cp travis/* .
cp .github/tooling/* .
runhaskell GenerateEverything.hs
./index.sh
agda -i. -isrc --html index.agda
agda -i. -idoc -isrc --html index.agda
mv html v$VERSION
git checkout gh-pages
git add v$VERSION/*.html v$VERSION/*.css
Expand Down
2 changes: 1 addition & 1 deletion src/Effect/Applicative.agda
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ record RawApplicative (F : Set f → Set g) : Set (suc f ⊔ g) where
-- Haskell-style alternative name for pure
return : A → F A
return = pure

-- backwards compatibility: unicode variants
_⊛_ : F (A → B) → F A → F B
_⊛_ = _<*>_
Expand Down
2 changes: 1 addition & 1 deletion src/Function/Bundles.agda
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ module _ (From : Setoid a ℓ₁) (To : Setoid b ℓ₂) where
-- For further background on (split) surjections, one may consult any
-- general mathematical references which work without the principle
-- of choice. For example:
--
--
-- https://ncatlab.org/nlab/show/split+epimorphism.
--
-- The connection to set-theoretic notions with the same names is
Expand Down