Giter Site home page Giter Site logo

Prune `Setup.hs` about agda HOT 5 CLOSED

lawcho avatar lawcho commented on June 20, 2024
Prune `Setup.hs`

from agda.

Comments (5)

UlfNorell avatar UlfNorell commented on June 20, 2024 1

I'm not seeing the benefits here. All the suggested alternatives for generating the agdai files put either more work on the developers or on the package maintainers. Your main complaint with Setup.hs seems to be lack of documentation, which I think is best addressed by adding documentation. If someone wants to cross-compile Agda, they can use the workaround suggested in the issue until it's been fixed.

from agda.

andreasabel avatar andreasabel commented on June 20, 2024

The (only) job of Setup.hs is to build the .agdai files for the primitive library.

Why should cabal install build them? Because Agda might be installed into the root area (e.g. in a system-wide installation), and if the installation does not include building the .agdai files there, Agda will not function with just user privileges.

We could skip this step and provide a script instead that does the job, and instruct packagers and admins to use the script.
(Note that the script then needs to be portable to all OSs or we need several scripts to cover the relevant OSs).
Still, this is a bit less "batteries included".

from agda.

lawcho avatar lawcho commented on June 20, 2024

Some alternatives for generating the .agdai files:

Generate .agdai at release-time

Generate .agdai immediately after cabal build

  • Tell packagers/users to run agda --dump-builtin-agdai-files DIR
  • Precedent: Haskell installer for agda-mode.el

Generate .agdai at run-time

When agda encounters import Agda.Builtin.Nat:

  • Dump Nat.agda to DIR/Agda/Builtin/Nat.agda
  • Type-check contents of DIR/ as Agda source code

How to calculate DIR

  1. Agda option --generated-modules-dir
    • or equivalent .agda-lib config
    • or equivalent env var
  2. _build/generated-modules/ (if .agda-lib is present)
  3. Wherever .agdai files normally go (e.g. in current working dir)

How to support the --safe flag

  • Type check the contents of DIR/ without the --safe flag
    • Allows Agda.Builtin.Nat to contain postulate
    • Allows Agda.Builtin.Nat to contain {-# COMPILE ... #-}
  • Suppress CoInfectiveImport errors for imports crossing the DIR/ boundary
    • Allows the user's code to --safely import Agda.Builtin.Nat

from agda.

gallais avatar gallais commented on June 20, 2024

Suppress CoInfectiveImport errors for imports crossing the DIR/ boundary

This kind of ad-hoc overriding of safety checks seems dangerous.
I would rather the (already complex) safety checking logic did not have such special cases.

from agda.

andreasabel avatar andreasabel commented on June 20, 2024
  • Check .agdai in to repo

That's definitely a no. The repo is already too fat (my .git is 1.1GB).
Anyway, I not see why they should be checked in. They could be created on the fly when assembling the sdist tarball.

from agda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.