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 ;;; Copyright © 2018 Alex ter Weele <alex.ter.weele@gmail.com>
6 ;;; This file is part of GNU Guix.
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.
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.
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/>.
21 (define-module (gnu packages idris)
22 #:use-module (gnu packages haskell)
23 #:use-module (gnu packages haskell-check)
24 #:use-module (gnu packages haskell-web)
25 #:use-module (gnu packages multiprecision)
26 #:use-module (gnu packages ncurses)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix build-system haskell)
29 #:use-module (guix download)
30 #:use-module (guix git-download)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix packages))
41 "https://hackage.haskell.org/package/"
42 "idris-" version "/idris-" version ".tar.gz"))
45 "1w5i2z88li4niykwc6yrgxgfp25ll6ih95cip0ri7d8i7ik03c48"))))
46 (build-system haskell-build-system)
50 ("ghc-aeson" ,ghc-aeson)
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)
54 ("ghc-async" ,ghc-async)
55 ("ghc-base64-bytestring" ,ghc-base64-bytestring)
56 ("ghc-blaze-html" ,ghc-blaze-html)
57 ("ghc-blaze-markup" ,ghc-blaze-markup)
58 ("ghc-cheapskate" ,ghc-cheapskate)
59 ("ghc-code-page" ,ghc-code-page)
60 ("ghc-fingertree" ,ghc-fingertree)
61 ("ghc-fsnotify" ,ghc-fsnotify)
62 ("ghc-ieee754" ,ghc-ieee754)
63 ("ghc-megaparsec" ,ghc-megaparsec)
64 ("ghc-network" ,ghc-network)
65 ("ghc-optparse-applicative" ,ghc-optparse-applicative)
66 ("ghc-regex-tdfa" ,ghc-regex-tdfa)
67 ("ghc-safe" ,ghc-safe)
68 ("ghc-split" ,ghc-split)
69 ("ghc-terminal-size" ,ghc-terminal-size)
70 ("ghc-text" ,ghc-text)
71 ("ghc-uniplate" ,ghc-uniplate)
72 ("ghc-unordered-containers" ,ghc-unordered-containers)
73 ("ghc-utf8-string" ,ghc-utf8-string)
74 ("ghc-vector" ,ghc-vector)
75 ("ghc-vector-binary-instances" ,ghc-vector-binary-instances)
76 ("ghc-zip-archive" ,ghc-zip-archive)))
78 `(#:tests? #f ; FIXME: Test suite doesn't run in a sandbox.
80 (list (string-append "--datasubdir="
81 (assoc-ref %outputs "out") "/lib/idris"))
83 (modify-phases %standard-phases
84 (add-before 'configure 'set-cc-command
88 (add-before 'configure 'update-constraints
90 (substitute* "idris.cabal"
91 (("aeson >= 0\\.6 && < 1\\.3")
92 "aeson >= 0.6 && < 1.4"))))
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")))
100 (symlink (string-append modules "/" module)
101 (string-append lib "/" module)))
102 '("prelude" "base" "contrib" "effects" "pruviloj"))))))))
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
110 types. It is compiled, with eager evaluation. Dependent types allow types to
111 be predicated on values, meaning that some aspects of a program's behaviour
112 can be specified precisely in the type. The language is closely related to
114 (license license:bsd-3)))
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)
123 (modify-phases %standard-phases
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
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))
149 (install-cmd (cons* idris-bin
150 "--ibcsubdir" ibcsubdir
152 ;; only trigger a build, as --ibcsubdir
153 ;; already installs .ibc files.
155 (apply append (map (lambda (path)
158 idris-path-subdirs)))))
159 ;; FIXME: Seems to be a bug in idris that causes a dubious failure.
160 (apply system* install-cmd)
163 (define-public idris-lightyear
164 (let ((commit "6d65ad111b4bed2bc131396f8385528fc6b3678a"))
166 (name "idris-lightyear")
167 (version (git-version "0.1" "1" commit))
171 (url "https://github.com/ziman/lightyear")
173 (file-name (git-file-name name version))
176 "1pkxnn3ryr0v0cin4nasw7kgkc9dnnpja1nfbj466mf3qv5s98af"))))
177 (build-system gnu-build-system)
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
184 by Parsec. This package is used (almost) the same way as Parsec, except for one
185 difference: backtracking.")
186 (license license:bsd-2))))
188 (define-public idris-wl-pprint
189 (let ((commit "1d365fcf4ba075859844dbc5eb96a90f57b9f338"))
191 (name "idris-wl-pprint")
192 (version (git-version "0.1" "1" commit))
196 (url "https://github.com/shayan-najd/wl-pprint")
198 (file-name (git-file-name name version))
201 "0g7c3y9smifdz4sivi3qmvymhdr7v9kfq45fmfmmvkqcrix0spzn"))))
202 (build-system gnu-build-system)
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
209 paper A Prettier Printer and on Daan Leijen's extensions in the Haskell
211 (license license:bsd-2))))
213 (define-public idris-bifunctors
214 (let ((commit "53d06a6ccfe70c49c9ae8c8a4135981dd2173202"))
216 (name "idris-bifunctors")
217 (version (git-version "0.1" "1" commit))
221 (url "https://github.com/HuwCampbell/Idris-Bifunctors")
223 (file-name (string-append name "-" version "-checkout"))
226 "02vbsd3rmgnj0l1qq787709qcxjbr9890cbad4ykn27f77jk81h4"))))
227 (build-system gnu-build-system)
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
234 excellent Haskell Bifunctors package from Edward Kmett.")
235 (license license:bsd-3))))
237 (define-public idris-lens
238 (let ((commit "26f012005f6849806cea630afe317e42cae97f29"))
241 (version (git-version "0.1" "1" commit))
245 (url "https://github.com/HuwCampbell/idris-lens")
247 (file-name (git-file-name name version))
250 "06jzfj6rad08rk92w8jk5byi79svmyg0mrcqhibgx8rkjjy6vmai"))))
251 (build-system gnu-build-system)
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
260 accessing and modifying data within a structure.")
261 (license license:bsd-3))))