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