1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Alex ter Weele <alex.ter.weele@gmail.com>
3 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
5 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2018 John Soo <jsoo1@asu.edu>
7 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages agda)
25 #:use-module (gnu packages haskell-check)
26 #:use-module (gnu packages haskell-web)
27 #:use-module (gnu packages haskell-xyz)
28 #:use-module (guix build-system emacs)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system haskell)
31 #:use-module (guix build-system trivial)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix packages))
45 "https://hackage.haskell.org/package/Agda/Agda-"
49 "1s600ry1qwizr3ynyj05rvlx7jdcw9a1viyc0ycjamm5sjf8mf3v"))))
50 (build-system haskell-build-system)
52 `(("ghc-aeson" ,ghc-aeson)
53 ("ghc-alex" ,ghc-alex)
54 ("ghc-async" ,ghc-async)
55 ("ghc-blaze-html" ,ghc-blaze-html)
56 ("ghc-boxes" ,ghc-boxes)
57 ("ghc-data-hash" ,ghc-data-hash)
58 ("ghc-edisoncore" ,ghc-edisoncore)
59 ("ghc-edit-distance" ,ghc-edit-distance)
60 ("ghc-equivalence" ,ghc-equivalence)
61 ("ghc-exceptions" ,ghc-exceptions)
62 ("ghc-filemanip" ,ghc-filemanip)
63 ("ghc-geniplate-mirror" ,ghc-geniplate-mirror)
64 ("ghc-gitrev" ,ghc-gitrev)
65 ("ghc-happy" ,ghc-happy)
66 ("ghc-hashable" ,ghc-hashable)
67 ("ghc-hashtables" ,ghc-hashtables)
68 ("ghc-ieee754" ,ghc-ieee754)
69 ("ghc-murmur-hash" ,ghc-murmur-hash)
70 ("ghc-uri-encode" ,ghc-uri-encode)
71 ("ghc-regex-tdfa" ,ghc-regex-tdfa)
72 ("ghc-strict" ,ghc-strict)
73 ("ghc-unordered-containers" ,ghc-unordered-containers)
74 ("ghc-zlib" ,ghc-zlib)))
76 `(#:modules ((guix build haskell-build-system)
81 (modify-phases %standard-phases
82 ;; This allows us to call the 'agda' binary before installing.
83 (add-after 'unpack 'set-ld-library-path
85 (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/dist/build"))
87 ;; FIXME: This is a copy of the standard configure phase with a tiny
88 ;; difference: this package needs the -package-db flag to be passed
89 ;; to "runhaskell" in addition to the "configure" action, because
90 ;; Setup.hs depends on filemanip. Without this option the Setup.hs
91 ;; file cannot be evaluated. The haskell-build-system should be
92 ;; changed to pass "-package-db" to "runhaskell" in any case.
94 (lambda* (#:key outputs inputs tests? (configure-flags '())
96 (let* ((out (assoc-ref outputs "out"))
97 (name-version (strip-store-file-name out))
98 (ghc-path (getenv "GHC_PACKAGE_PATH"))
100 `(,(string-append "--prefix=" out)
101 ,(string-append "--libdir=" out "/lib")
102 ,(string-append "--docdir=" out
103 "/share/doc/" name-version)
104 "--libsubdir=$compiler/$pkg-$version"
105 "--package-db=../package.conf.d"
110 ;; Build and link with shared libraries
112 "--enable-executable-dynamic"
114 ,(string-append "--ghc-option=-optl=-Wl,-rpath=" out
115 "/lib/$compiler/$pkg-$version")
117 (unsetenv "GHC_PACKAGE_PATH")
118 (apply invoke "runhaskell" "-package-db=../package.conf.d"
119 "Setup.hs" "configure" params)
120 (setenv "GHC_PACKAGE_PATH" ghc-path)
122 (add-after 'compile 'agda-compile
123 (lambda* (#:key outputs #:allow-other-keys)
124 (let* ((out (assoc-ref outputs "out"))
125 (agda-compiler (string-append out "/bin/agda")))
126 (for-each (cut invoke agda-compiler <>)
127 (find-files (string-append out "/share") "\\.agda$"))
129 (home-page "https://wiki.portal.chalmers.se/agda/")
131 "Dependently typed functional programming language and proof assistant")
133 "Agda is a dependently typed functional programming language: it has
134 inductive families, which are similar to Haskell's GADTs, but they can be
135 indexed by values and not just types. It also has parameterised modules,
136 mixfix operators, Unicode characters, and an interactive Emacs interface (the
137 type checker can assist in the development of your code). Agda is also a
138 proof assistant: it is an interactive system for writing and checking proofs.
139 Agda is based on intuitionistic type theory, a foundational system for
140 constructive mathematics developed by the Swedish logician Per Martin-Löf. It
141 has many similarities with other proof assistants based on dependent types,
142 such as Coq, Epigram and NuPRL.")
143 ;; Agda is distributed under the MIT license, and a couple of
144 ;; source files are BSD-3. See LICENSE for details.
145 (license (list license:expat license:bsd-3))))
147 (define-public emacs-agda2-mode
150 (name "emacs-agda2-mode")
151 (build-system emacs-build-system)
155 (modify-phases %standard-phases
156 (add-after 'unpack 'enter-elisp-dir
157 (lambda _ (chdir "src/data/emacs-mode") #t)))))
158 (home-page "https://agda.readthedocs.io/en/latest/tools/emacs-mode.html")
159 (synopsis "Emacs mode for Agda")
160 (description "This Emacs mode enables interactive development with
161 Agda. It also aids the input of Unicode characters.")))
163 (define-public agda-ial
167 (home-page "https://github.com/cedille/ial")
170 (uri (git-reference (url home-page)
171 (commit (string-append "v" version))))
172 (file-name (git-file-name name version))
175 "0dlis6v6nzbscf713cmwlx8h9n2gxghci8y21qak3hp18gkxdp0g"))))
176 (build-system gnu-build-system)
180 `(#:parallel-build? #f
182 (modify-phases %standard-phases
184 (add-before 'build 'patch-dependencies
185 (lambda _ (patch-shebang "find-deps.sh") #t))
188 (lambda* (#:key outputs #:allow-other-keys)
189 (let* ((out (assoc-ref outputs "out"))
190 (include (string-append out "/include/agda/ial")))
191 (for-each (lambda (file)
192 (make-file-writable file)
193 (install-file file include))
194 (find-files "." "\\.agdai?(-lib)?$"))
196 (synopsis "The Iowa Agda Library")
198 "The goal is to provide a concrete library focused on verification
199 examples, as opposed to mathematics. The library has a good number
200 of theorems for booleans, natural numbers, and lists. It also has
201 trees, tries, vectors, and rudimentary IO. A number of good ideas
202 come from Agda's standard library.")
203 (license license:expat)))