gnu: bootstrap: Memoize 'bootstrap-origin'.
[jackhill/guix/guix.git] / gnu / packages / idris.scm
CommitLineData
ae482ce1
DC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
3;;; Copyright © 2016, 2017 David Craven <david@craven.ch>
d661ed52 4;;; Copyright © 2018 Alex ter Weele <alex.ter.weele@gmail.com>
a4df9ba4 5;;; Copyright © 2019 Eric Bavier <bavier@member.fsf.org>
ae482ce1
DC
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages idris)
89647ff1 23 #:use-module (gnu packages)
a06b9b50 24 #:use-module (gnu packages haskell-check)
44b7374a 25 #:use-module (gnu packages haskell-web)
dddbc90c 26 #:use-module (gnu packages haskell-xyz)
e16bc710 27 #:use-module (gnu packages libffi)
ae482ce1
DC
28 #:use-module (gnu packages multiprecision)
29 #:use-module (gnu packages ncurses)
89647ff1 30 #:use-module (gnu packages perl)
ea3b38f1 31 #:use-module (guix build-system gnu)
ae482ce1 32 #:use-module (guix build-system haskell)
ae482ce1
DC
33 #:use-module (guix download)
34 #:use-module (guix git-download)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix packages))
37
38(define-public idris
39 (package
40 (name "idris")
4780db2c 41 (version "1.3.2")
ae482ce1
DC
42 (source (origin
43 (method url-fetch)
44 (uri (string-append
45 "https://hackage.haskell.org/package/"
46 "idris-" version "/idris-" version ".tar.gz"))
47 (sha256
48 (base32
4780db2c 49 "0wychzkg0yghd2pp8fqz78vp1ayzks191knfpl7mhh8igsmb6bc7"))))
ae482ce1 50 (build-system haskell-build-system)
89647ff1
EB
51 (native-inputs ;For tests
52 `(("perl" ,perl)
53 ("ghc-tasty" ,ghc-tasty)
54 ("ghc-tasty-golden" ,ghc-tasty-golden)
55 ("ghc-tasty-rerun" ,ghc-tasty-rerun)))
ae482ce1
DC
56 (inputs
57 `(("gmp" ,gmp)
58 ("ncurses" ,ncurses)
53812aa7 59 ("ghc-aeson" ,ghc-aeson)
ae482ce1
DC
60 ("ghc-annotated-wl-pprint" ,ghc-annotated-wl-pprint)
61 ("ghc-ansi-terminal" ,ghc-ansi-terminal)
62 ("ghc-ansi-wl-pprint" ,ghc-ansi-wl-pprint)
d661ed52 63 ("ghc-async" ,ghc-async)
ae482ce1
DC
64 ("ghc-base64-bytestring" ,ghc-base64-bytestring)
65 ("ghc-blaze-html" ,ghc-blaze-html)
66 ("ghc-blaze-markup" ,ghc-blaze-markup)
53812aa7 67 ("ghc-cheapskate" ,ghc-cheapskate)
c53af001 68 ("ghc-code-page" ,ghc-code-page)
ae482ce1
DC
69 ("ghc-fingertree" ,ghc-fingertree)
70 ("ghc-fsnotify" ,ghc-fsnotify)
71 ("ghc-ieee754" ,ghc-ieee754)
e16bc710 72 ("ghc-libffi" ,ghc-libffi)
4780db2c
EB
73 ("ghc-megaparsec" ,ghc-megaparsec-7)
74 ("ghc-network" ,ghc-network-2.8)
ae482ce1 75 ("ghc-optparse-applicative" ,ghc-optparse-applicative)
ae482ce1
DC
76 ("ghc-regex-tdfa" ,ghc-regex-tdfa)
77 ("ghc-safe" ,ghc-safe)
78 ("ghc-split" ,ghc-split)
ae482ce1 79 ("ghc-terminal-size" ,ghc-terminal-size)
ae482ce1
DC
80 ("ghc-uniplate" ,ghc-uniplate)
81 ("ghc-unordered-containers" ,ghc-unordered-containers)
82 ("ghc-utf8-string" ,ghc-utf8-string)
ae482ce1 83 ("ghc-vector" ,ghc-vector)
d661ed52
AW
84 ("ghc-vector-binary-instances" ,ghc-vector-binary-instances)
85 ("ghc-zip-archive" ,ghc-zip-archive)))
ae482ce1 86 (arguments
89647ff1 87 `(#:configure-flags
ae482ce1 88 (list (string-append "--datasubdir="
e16bc710
EB
89 (assoc-ref %outputs "out") "/lib/idris")
90 "-fFFI" "-fGMP")
ae482ce1
DC
91 #:phases
92 (modify-phases %standard-phases
93 (add-before 'configure 'set-cc-command
94 (lambda _
95 (setenv "CC" "gcc")
96 #t))
97 (add-after 'install 'fix-libs-install-location
98 (lambda* (#:key outputs #:allow-other-keys)
99 (let* ((out (assoc-ref outputs "out"))
100 (lib (string-append out "/lib/idris"))
101 (modules (string-append lib "/libs")))
102 (for-each
103 (lambda (module)
104 (symlink (string-append modules "/" module)
105 (string-append lib "/" module)))
89647ff1
EB
106 '("prelude" "base" "contrib" "effects" "pruviloj")))))
107 (delete 'check) ;Run check later
108 (add-after 'install 'check
109 (lambda* (#:key outputs #:allow-other-keys #:rest args)
110 (let ((out (assoc-ref outputs "out")))
111 (setenv "TASTY_NUM_THREADS" (number->string (parallel-job-count)))
112 (setenv "IDRIS_CC" "gcc") ;Needed for creating executables
113 (setenv "PATH" (string-append out "/bin:" (getenv "PATH")))
114 (apply (assoc-ref %standard-phases 'check) args)))))))
ae482ce1
DC
115 (native-search-paths
116 (list (search-path-specification
117 (variable "IDRIS_LIBRARY_PATH")
118 (files '("lib/idris")))))
119 (home-page "http://www.idris-lang.org")
120 (synopsis "General purpose language with full dependent types")
121 (description "Idris is a general purpose language with full dependent
122types. It is compiled, with eager evaluation. Dependent types allow types to
123be predicated on values, meaning that some aspects of a program's behaviour
124can be specified precisely in the type. The language is closely related to
125Epigram and Agda.")
126 (license license:bsd-3)))
ea3b38f1
DC
127
128;; Idris modules use the gnu-build-system so that the IDRIS_LIBRARY_PATH is set.
129(define (idris-default-arguments name)
130 `(#:modules ((guix build gnu-build-system)
131 (guix build utils)
132 (ice-9 ftw)
133 (ice-9 match))
134 #:phases
135 (modify-phases %standard-phases
136 (delete 'configure)
137 (delete 'build)
138 (delete 'check)
139 (replace 'install
140 (lambda* (#:key inputs outputs #:allow-other-keys)
141 (let* ((out (assoc-ref outputs "out"))
142 (idris (assoc-ref inputs "idris"))
143 (idris-bin (string-append idris "/bin/idris"))
144 (idris-libs (string-append idris "/lib/idris/libs"))
145 (module-name (and (string-prefix? "idris-" ,name)
146 (substring ,name 6)))
147 (ibcsubdir (string-append out "/lib/idris/" module-name))
148 (ipkg (string-append module-name ".ipkg"))
149 (idris-library-path (getenv "IDRIS_LIBRARY_PATH"))
150 (idris-path (string-split idris-library-path #\:))
151 (idris-path-files (apply append
152 (map (lambda (path)
153 (map (lambda (dir)
154 (string-append path "/" dir))
155 (scandir path))) idris-path)))
156 (idris-path-subdirs (filter (lambda (path)
157 (and path (match (stat:type (stat path))
158 ('directory #t)
159 (_ #f))))
160 idris-path-files))
161 (install-cmd (cons* idris-bin
162 "--ibcsubdir" ibcsubdir
178670c9
PM
163 "--build" ipkg
164 ;; only trigger a build, as --ibcsubdir
165 ;; already installs .ibc files.
166
ea3b38f1
DC
167 (apply append (map (lambda (path)
168 (list "--idrispath"
169 path))
170 idris-path-subdirs)))))
ea3b38f1
DC
171 ;; FIXME: Seems to be a bug in idris that causes a dubious failure.
172 (apply system* install-cmd)
173 #t))))))
174
175(define-public idris-lightyear
176 (let ((commit "6d65ad111b4bed2bc131396f8385528fc6b3678a"))
177 (package
178 (name "idris-lightyear")
179 (version (git-version "0.1" "1" commit))
180 (source (origin
181 (method git-fetch)
182 (uri (git-reference
183 (url "https://github.com/ziman/lightyear")
184 (commit commit)))
185 (file-name (git-file-name name version))
186 (sha256
187 (base32
188 "1pkxnn3ryr0v0cin4nasw7kgkc9dnnpja1nfbj466mf3qv5s98af"))))
189 (build-system gnu-build-system)
190 (native-inputs
191 `(("idris" ,idris)))
192 (arguments (idris-default-arguments name))
193 (home-page "https://github.com/ziman/lightyear")
194 (synopsis "Lightweight parser combinator library for Idris")
195 (description "Lightweight parser combinator library for Idris, inspired
196by Parsec. This package is used (almost) the same way as Parsec, except for one
197difference: backtracking.")
198 (license license:bsd-2))))
4e17fff3
DC
199
200(define-public idris-wl-pprint
201 (let ((commit "1d365fcf4ba075859844dbc5eb96a90f57b9f338"))
202 (package
203 (name "idris-wl-pprint")
204 (version (git-version "0.1" "1" commit))
205 (source (origin
206 (method git-fetch)
207 (uri (git-reference
208 (url "https://github.com/shayan-najd/wl-pprint")
209 (commit commit)))
210 (file-name (git-file-name name version))
211 (sha256
212 (base32
213 "0g7c3y9smifdz4sivi3qmvymhdr7v9kfq45fmfmmvkqcrix0spzn"))))
214 (build-system gnu-build-system)
215 (native-inputs
216 `(("idris" ,idris)))
217 (arguments (idris-default-arguments name))
218 (home-page "https://github.com/shayan-najd/wl-pprint")
219 (synopsis "Pretty printing library")
220 (description "A pretty printing library for Idris based on Phil Wadler's
221paper A Prettier Printer and on Daan Leijen's extensions in the Haskell
222wl-pprint library.")
223 (license license:bsd-2))))
5a16d828
DC
224
225(define-public idris-bifunctors
226 (let ((commit "53d06a6ccfe70c49c9ae8c8a4135981dd2173202"))
227 (package
228 (name "idris-bifunctors")
229 (version (git-version "0.1" "1" commit))
230 (source (origin
231 (method git-fetch)
232 (uri (git-reference
233 (url "https://github.com/HuwCampbell/Idris-Bifunctors")
234 (commit commit)))
235 (file-name (string-append name "-" version "-checkout"))
236 (sha256
237 (base32
238 "02vbsd3rmgnj0l1qq787709qcxjbr9890cbad4ykn27f77jk81h4"))))
239 (build-system gnu-build-system)
240 (native-inputs
241 `(("idris" ,idris)))
242 (arguments (idris-default-arguments name))
243 (home-page "https://github.com/HuwCampbell/Idris-Bifunctors")
244 (synopsis "Bifunctor library")
245 (description "This is a bifunctor library for Idris based off the
246excellent Haskell Bifunctors package from Edward Kmett.")
247 (license license:bsd-3))))
3254e1ab
DC
248
249(define-public idris-lens
250 (let ((commit "26f012005f6849806cea630afe317e42cae97f29"))
251 (package
252 (name "idris-lens")
253 (version (git-version "0.1" "1" commit))
254 (source (origin
255 (method git-fetch)
256 (uri (git-reference
257 (url "https://github.com/HuwCampbell/idris-lens")
258 (commit commit)))
259 (file-name (git-file-name name version))
260 (sha256
261 (base32
262 "06jzfj6rad08rk92w8jk5byi79svmyg0mrcqhibgx8rkjjy6vmai"))))
263 (build-system gnu-build-system)
264 (native-inputs
265 `(("idris" ,idris)))
266 (propagated-inputs
267 `(("idris-bifunctors" ,idris-bifunctors)))
268 (arguments (idris-default-arguments name))
269 (home-page "https://github.com/HuwCampbell/idris-lens")
270 (synopsis "Van Laarhoven lenses for Idris")
271 (description "Lenses are composable functional references. They allow
272accessing and modifying data within a structure.")
273 (license license:bsd-3))))