idris.scm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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>
  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. (define-module (gnu packages idris)
  21. #:use-module (gnu packages haskell)
  22. #:use-module (gnu packages haskell-check)
  23. #:use-module (gnu packages haskell-web)
  24. #:use-module (gnu packages multiprecision)
  25. #:use-module (gnu packages ncurses)
  26. #:use-module (guix build-system gnu)
  27. #:use-module (guix build-system haskell)
  28. #:use-module (guix download)
  29. #:use-module (guix git-download)
  30. #:use-module ((guix licenses) #:prefix license:)
  31. #:use-module (guix packages))
  32. (define-public idris
  33. (package
  34. (name "idris")
  35. (version "1.3.0")
  36. (source (origin
  37. (method url-fetch)
  38. (uri (string-append
  39. "https://hackage.haskell.org/package/"
  40. "idris-" version "/idris-" version ".tar.gz"))
  41. (sha256
  42. (base32
  43. "1w5i2z88li4niykwc6yrgxgfp25ll6ih95cip0ri7d8i7ik03c48"))))
  44. (build-system haskell-build-system)
  45. (inputs
  46. `(("gmp" ,gmp)
  47. ("ncurses" ,ncurses)
  48. ("ghc-aeson" ,ghc-aeson)
  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-async" ,ghc-async)
  53. ("ghc-base64-bytestring" ,ghc-base64-bytestring)
  54. ("ghc-blaze-html" ,ghc-blaze-html)
  55. ("ghc-blaze-markup" ,ghc-blaze-markup)
  56. ("ghc-cheapskate" ,ghc-cheapskate)
  57. ("ghc-code-page" ,ghc-code-page)
  58. ("ghc-fingertree" ,ghc-fingertree)
  59. ("ghc-fsnotify" ,ghc-fsnotify)
  60. ("ghc-ieee754" ,ghc-ieee754)
  61. ("ghc-megaparsec" ,ghc-megaparsec)
  62. ("ghc-network" ,ghc-network)
  63. ("ghc-optparse-applicative" ,ghc-optparse-applicative)
  64. ("ghc-regex-tdfa" ,ghc-regex-tdfa)
  65. ("ghc-safe" ,ghc-safe)
  66. ("ghc-split" ,ghc-split)
  67. ("ghc-terminal-size" ,ghc-terminal-size)
  68. ("ghc-text" ,ghc-text)
  69. ("ghc-uniplate" ,ghc-uniplate)
  70. ("ghc-unordered-containers" ,ghc-unordered-containers)
  71. ("ghc-utf8-string" ,ghc-utf8-string)
  72. ("ghc-vector" ,ghc-vector)
  73. ("ghc-vector-binary-instances" ,ghc-vector-binary-instances)
  74. ("ghc-zip-archive" ,ghc-zip-archive)))
  75. (arguments
  76. `(#:tests? #f ; FIXME: Test suite doesn't run in a sandbox.
  77. #:configure-flags
  78. (list (string-append "--datasubdir="
  79. (assoc-ref %outputs "out") "/lib/idris"))
  80. #:phases
  81. (modify-phases %standard-phases
  82. (add-before 'configure 'set-cc-command
  83. (lambda _
  84. (setenv "CC" "gcc")
  85. #t))
  86. (add-before 'configure 'update-constraints
  87. (lambda _
  88. (substitute* "idris.cabal"
  89. (("aeson >= 0\\.6 && < 1\\.3")
  90. "aeson >= 0.6 && < 1.4"))))
  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
  108. types. It is compiled, with eager evaluation. Dependent types allow types to
  109. be predicated on values, meaning that some aspects of a program's behaviour
  110. can be specified precisely in the type. The language is closely related to
  111. Epigram and Agda.")
  112. (license license:bsd-3)))
  113. ;; Idris modules use the gnu-build-system so that the IDRIS_LIBRARY_PATH is set.
  114. (define (idris-default-arguments name)
  115. `(#:modules ((guix build gnu-build-system)
  116. (guix build utils)
  117. (ice-9 ftw)
  118. (ice-9 match))
  119. #:phases
  120. (modify-phases %standard-phases
  121. (delete 'configure)
  122. (delete 'build)
  123. (delete 'check)
  124. (replace 'install
  125. (lambda* (#:key inputs outputs #:allow-other-keys)
  126. (let* ((out (assoc-ref outputs "out"))
  127. (idris (assoc-ref inputs "idris"))
  128. (idris-bin (string-append idris "/bin/idris"))
  129. (idris-libs (string-append idris "/lib/idris/libs"))
  130. (module-name (and (string-prefix? "idris-" ,name)
  131. (substring ,name 6)))
  132. (ibcsubdir (string-append out "/lib/idris/" module-name))
  133. (ipkg (string-append module-name ".ipkg"))
  134. (idris-library-path (getenv "IDRIS_LIBRARY_PATH"))
  135. (idris-path (string-split idris-library-path #\:))
  136. (idris-path-files (apply append
  137. (map (lambda (path)
  138. (map (lambda (dir)
  139. (string-append path "/" dir))
  140. (scandir path))) idris-path)))
  141. (idris-path-subdirs (filter (lambda (path)
  142. (and path (match (stat:type (stat path))
  143. ('directory #t)
  144. (_ #f))))
  145. idris-path-files))
  146. (install-cmd (cons* idris-bin
  147. "--ibcsubdir" ibcsubdir
  148. "--build" ipkg
  149. ;; only trigger a build, as --ibcsubdir
  150. ;; already installs .ibc files.
  151. (apply append (map (lambda (path)
  152. (list "--idrispath"
  153. path))
  154. idris-path-subdirs)))))
  155. ;; FIXME: Seems to be a bug in idris that causes a dubious failure.
  156. (apply system* install-cmd)
  157. #t))))))
  158. (define-public idris-lightyear
  159. (let ((commit "6d65ad111b4bed2bc131396f8385528fc6b3678a"))
  160. (package
  161. (name "idris-lightyear")
  162. (version (git-version "0.1" "1" commit))
  163. (source (origin
  164. (method git-fetch)
  165. (uri (git-reference
  166. (url "https://github.com/ziman/lightyear")
  167. (commit commit)))
  168. (file-name (git-file-name name version))
  169. (sha256
  170. (base32
  171. "1pkxnn3ryr0v0cin4nasw7kgkc9dnnpja1nfbj466mf3qv5s98af"))))
  172. (build-system gnu-build-system)
  173. (native-inputs
  174. `(("idris" ,idris)))
  175. (arguments (idris-default-arguments name))
  176. (home-page "https://github.com/ziman/lightyear")
  177. (synopsis "Lightweight parser combinator library for Idris")
  178. (description "Lightweight parser combinator library for Idris, inspired
  179. by Parsec. This package is used (almost) the same way as Parsec, except for one
  180. difference: backtracking.")
  181. (license license:bsd-2))))
  182. (define-public idris-wl-pprint
  183. (let ((commit "1d365fcf4ba075859844dbc5eb96a90f57b9f338"))
  184. (package
  185. (name "idris-wl-pprint")
  186. (version (git-version "0.1" "1" commit))
  187. (source (origin
  188. (method git-fetch)
  189. (uri (git-reference
  190. (url "https://github.com/shayan-najd/wl-pprint")
  191. (commit commit)))
  192. (file-name (git-file-name name version))
  193. (sha256
  194. (base32
  195. "0g7c3y9smifdz4sivi3qmvymhdr7v9kfq45fmfmmvkqcrix0spzn"))))
  196. (build-system gnu-build-system)
  197. (native-inputs
  198. `(("idris" ,idris)))
  199. (arguments (idris-default-arguments name))
  200. (home-page "https://github.com/shayan-najd/wl-pprint")
  201. (synopsis "Pretty printing library")
  202. (description "A pretty printing library for Idris based on Phil Wadler's
  203. paper A Prettier Printer and on Daan Leijen's extensions in the Haskell
  204. wl-pprint library.")
  205. (license license:bsd-2))))
  206. (define-public idris-bifunctors
  207. (let ((commit "53d06a6ccfe70c49c9ae8c8a4135981dd2173202"))
  208. (package
  209. (name "idris-bifunctors")
  210. (version (git-version "0.1" "1" commit))
  211. (source (origin
  212. (method git-fetch)
  213. (uri (git-reference
  214. (url "https://github.com/HuwCampbell/Idris-Bifunctors")
  215. (commit commit)))
  216. (file-name (string-append name "-" version "-checkout"))
  217. (sha256
  218. (base32
  219. "02vbsd3rmgnj0l1qq787709qcxjbr9890cbad4ykn27f77jk81h4"))))
  220. (build-system gnu-build-system)
  221. (native-inputs
  222. `(("idris" ,idris)))
  223. (arguments (idris-default-arguments name))
  224. (home-page "https://github.com/HuwCampbell/Idris-Bifunctors")
  225. (synopsis "Bifunctor library")
  226. (description "This is a bifunctor library for Idris based off the
  227. excellent Haskell Bifunctors package from Edward Kmett.")
  228. (license license:bsd-3))))
  229. (define-public idris-lens
  230. (let ((commit "26f012005f6849806cea630afe317e42cae97f29"))
  231. (package
  232. (name "idris-lens")
  233. (version (git-version "0.1" "1" commit))
  234. (source (origin
  235. (method git-fetch)
  236. (uri (git-reference
  237. (url "https://github.com/HuwCampbell/idris-lens")
  238. (commit commit)))
  239. (file-name (git-file-name name version))
  240. (sha256
  241. (base32
  242. "06jzfj6rad08rk92w8jk5byi79svmyg0mrcqhibgx8rkjjy6vmai"))))
  243. (build-system gnu-build-system)
  244. (native-inputs
  245. `(("idris" ,idris)))
  246. (propagated-inputs
  247. `(("idris-bifunctors" ,idris-bifunctors)))
  248. (arguments (idris-default-arguments name))
  249. (home-page "https://github.com/HuwCampbell/idris-lens")
  250. (synopsis "Van Laarhoven lenses for Idris")
  251. (description "Lenses are composable functional references. They allow
  252. accessing and modifying data within a structure.")
  253. (license license:bsd-3))))