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