1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages haskell)
20 #:use-module (ice-9 regex)
21 #:use-module ((guix licenses) #:select (bsd-3))
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix utils)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system haskell)
27 #:use-module (gnu packages perl)
28 #:use-module (gnu packages compression)
29 #:use-module (gnu packages elf)
30 #:use-module (gnu packages bootstrap)
31 #:use-module (gnu packages ghostscript)
32 #:use-module (gnu packages libffi)
33 #:use-module (gnu packages libedit)
34 #:use-module (gnu packages multiprecision)
35 #:use-module (gnu packages ncurses)
36 #:use-module (gnu packages python))
38 (define ghc-bootstrap-x86_64-7.8.4
42 "https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-x86_64-unknown-linux-deb7.tar.xz")
45 "13azsl53xgj20mi1hj9x0xb32vvcvs6cpmvwx6znxhas7blh0bpn"))))
47 (define ghc-bootstrap-i686-7.8.4
51 "https://www.haskell.org/ghc/dist/7.8.4/ghc-7.8.4-i386-unknown-linux-deb7.tar.xz")
54 "0wj5s435j0zgww70bj1d3f6wvnnpzlxwvwcyh2qv4qjq5z8j64kg"))))
56 ;; 43 tests out of 3965 fail.
58 ;; Most of them do not appear to be serious:
60 ;; - some tests generate files referring to "/bin/sh" and "/bin/ls". I've not
61 ;; figured out how these references are generated.
63 ;; - Some tests allocate more memory than expected (ca. 3% above upper limit)
65 ;; - Some tests try to load unavailable libriries: Control.Concurrent.STM,
66 ;; Data.Vector, Control.Monad.State.
68 ;; - Test posix010 tries to check the existence of a user on the system:
69 ;; getUserEntryForName: does not exist (no such user)
77 (uri (string-append "https://www.haskell.org/ghc/dist/"
78 version "/" name "-" version "-src.tar.xz"))
81 "1i4254akbb4ym437rf469gc0m40bxm31blp6s1z1g15jmnacs6f3"))))
82 (build-system gnu-build-system)
83 (supported-systems '("i686-linux" "x86_64-linux"))
84 (outputs '("out" "doc"))
94 "https://www.haskell.org/ghc/dist/"
95 version "/" name "-" version "-testsuite.tar.xz"))
98 "0q95whf87y4mxjzwzy899g7z7l9pazq4si6iciyhxkcdhqq2ycyh"))))))
101 ("python" ,python-2) ; for tests (fails with python-3)
102 ("ghostscript" ,ghostscript) ; for tests
103 ("patchelf" ,patchelf)
104 ;; GHC is built with GHC. Therefore we need bootstrap binaries.
106 ,(if (string-match "x86_64" (or (%current-target-system) (%current-system)))
107 ghc-bootstrap-x86_64-7.8.4
108 ghc-bootstrap-i686-7.8.4))))
110 `(#:test-target "test"
111 ;; We get a smaller number of test failures by disabling parallel test
114 #:modules ((guix build gnu-build-system)
119 #:imported-modules ((guix build gnu-build-system)
124 (string-append "--with-gmp-libraries="
125 (assoc-ref %build-inputs "gmp") "/lib")
126 (string-append "--with-gmp-includes="
127 (assoc-ref %build-inputs "gmp") "/include")
128 "--with-system-libffi"
129 (string-append "--with-ffi-libraries="
130 (assoc-ref %build-inputs "libffi") "/lib")
131 (string-append "--with-ffi-includes="
132 (assoc-ref %build-inputs "libffi") "/include"))
133 ;; FIXME: The user-guide needs dblatex, docbook-xsl and docbook-utils.
134 ;; Currently we do not have the last one.
136 ;; (list "BUILD_DOCBOOK_HTML = YES")
138 (let* ((ghc-bootstrap-path
139 (string-append (getcwd) "/" ,name "-" ,version "/ghc-bin"))
140 (ghc-bootstrap-prefix
141 (string-append ghc-bootstrap-path "/usr" )))
143 'unpack-bin 'unpack-and-fix-testsuite
144 (lambda* (#:key inputs outputs #:allow-other-keys)
145 (with-directory-excursion ".."
146 (copy-file (assoc-ref inputs "ghc-testsuite")
147 "ghc-testsuite.tar.xz")
148 (system* "tar" "xvf" "ghc-testsuite.tar.xz"))
150 (list "testsuite/timeout/Makefile"
151 "testsuite/timeout/timeout.py"
152 "testsuite/timeout/timeout.hs"
153 "testsuite/tests/rename/prog006/Setup.lhs"
154 "testsuite/tests/programs/life_space_leak/life.test")
155 (("/bin/sh") (which "sh"))
160 (lambda* (#:key inputs outputs #:allow-other-keys)
161 (mkdir-p ghc-bootstrap-prefix)
162 (with-directory-excursion ghc-bootstrap-path
163 (copy-file (assoc-ref inputs "ghc-binary")
165 (zero? (system* "tar" "xvf" "ghc-bin.tar.xz"))))
167 'install-bin 'configure-bin
168 (lambda* (#:key inputs outputs #:allow-other-keys)
171 "./utils/ghc-pwd/dist-install/build/tmp/ghc-pwd"
172 "./utils/hpc/dist-install/build/tmp/hpc"
173 "./utils/haddock/dist/build/tmp/haddock"
174 "./utils/hsc2hs/dist-install/build/tmp/hsc2hs"
175 "./utils/runghc/dist-install/build/tmp/runghc"
176 "./utils/ghc-cabal/dist-install/build/tmp/ghc-cabal"
177 "./utils/hp2ps/dist/build/tmp/hp2ps"
178 "./utils/ghc-pkg/dist-install/build/tmp/ghc-pkg"
179 "./utils/unlit/dist/build/tmp/unlit"
180 "./ghc/stage2/build/tmp/ghc-stage2"))
181 (gmp (assoc-ref inputs "gmp"))
182 (gmp-lib (string-append gmp "/lib"))
183 (gmp-include (string-append gmp "/include"))
185 (string-append (assoc-ref inputs "ncurses") "/lib"))
186 (ld-so (string-append (assoc-ref inputs "libc")
187 ,(glibc-dynamic-linker)))
189 (string-append ghc-bootstrap-prefix
190 "/lib/ghc-7.8.4/terminfo-0.4.0.0")))
191 (with-directory-excursion
192 (string-append ghc-bootstrap-path "/" ,name "-" ,version)
193 (setenv "CONFIG_SHELL" (which "bash"))
194 (setenv "LD_LIBRARY_PATH" gmp-lib)
195 ;; The binaries have "/lib64/ld-linux-x86-64.so.2" hardcoded.
197 (cut system* "patchelf" "--set-interpreter" ld-so <>)
199 ;; The binaries include a reference to libtinfo.so.5 which
200 ;; is a subset of libncurses.so.5. We create a symlink in a
201 ;; directory included in the bootstrap binaries rpath.
202 (mkdir-p libtinfo-dir)
204 (string-append ncurses-lib "/libncursesw.so."
205 ,(version-major+minor
206 (package-version ncurses)))
207 (string-append libtinfo-dir "/libtinfo.so.5"))
209 (string-append (getenv "PATH") ":"
210 ghc-bootstrap-prefix "/bin"))
212 (string-append (getcwd) "/configure")
213 (string-append "--prefix=" ghc-bootstrap-prefix)
214 (string-append "--with-gmp-libraries=" gmp-lib)
215 (string-append "--with-gmp-includes=" gmp-include)))))
217 'configure 'install-bin
218 (lambda* (#:key inputs outputs #:allow-other-keys)
219 (with-directory-excursion
220 (string-append ghc-bootstrap-path "/" ,name "-" ,version)
221 (zero? (system* "make" "install"))))
222 %standard-phases)))))))
223 (home-page "https://www.haskell.org/ghc")
224 (synopsis "The Glasgow Haskell Compiler")
226 "The Glasgow Haskell Compiler (GHC) is a state-of-the-art compiler and
227 interactive environment for the functional language Haskell.")
230 (define-public ghc-mtl
234 (outputs '("out" "doc"))
239 "http://hackage.haskell.org/package/mtl/mtl-"
244 "1xpn2wjmqbh2cg1yssc6749xpgcqlrrg4iilwqgkcjgvaxlpdbvp"))))
245 (build-system haskell-build-system)
246 (home-page "http://github.com/ekmett/mtl")
248 "Monad classes, using functional dependencies")
250 "Monad classes using functional dependencies, with instances
251 for various monad transformers, inspired by the paper
252 'Functional Programming with Overloading and Higher-Order Polymorphism',
253 by Mark P Jones, in 'Advanced School of Functional Programming', 1995
254 http://web.cecs.pdx.edu/~mpj/pubs/springschool.html.")
257 (define-public ghc-paths
261 (outputs '("out" "doc"))
266 "http://hackage.haskell.org/package/ghc-paths/ghc-paths-"
271 "0ibrr1dxa35xx20cpp8jzgfak1rdmy344dfwq4vlq013c6w8z9mg"))))
272 (build-system haskell-build-system)
273 (home-page "https://github.com/simonmar/ghc-paths")
275 "Knowledge of GHC's installation directories")
277 "Knowledge of GHC's installation directories.")
280 (define-public ghc-zlib
284 (outputs '("out" "doc"))
289 "http://hackage.haskell.org/package/zlib/zlib-"
294 "15hhsk7z3gvm7sz2ic2z1ca5c6rpsln2rr391mdbm1bxlzc1gmkm"))))
295 (build-system haskell-build-system)
296 (inputs `(("zlib" ,zlib)))
297 (home-page "http://hackage.haskell.org/package/zlib")
299 "Compression and decompression in the gzip and zlib formats")
301 "This package provides a pure interface for compressing and decompressing
302 streams of data represented as lazy 'ByteString's. It uses the zlib C library
303 so it has high performance. It supports the 'zlib', 'gzip' and 'raw'
304 compression formats. It provides a convenient high level API suitable for
305 most tasks and for the few cases where more control is needed it provides
306 access to the full zlib feature set.")
309 (define-public ghc-stm
313 (outputs '("out" "doc"))
318 "http://hackage.haskell.org/package/stm/stm-"
323 "0gc8zvdijp3rwmidkpxv76b4i0dc8dw6nbd92rxl4vxl0655iysx"))))
324 (build-system haskell-build-system)
325 (home-page "http://hackage.haskell.org/package/stm")
326 (synopsis "Software Transactional Memory")
328 "A modular composable concurrency abstraction.")
331 (define-public ghc-parallel
333 (name "ghc-parallel")
335 (outputs '("out" "doc"))
340 "http://hackage.haskell.org/package/parallel/parallel-"
345 "0hp6vf4zxsw6vz6lj505xihmnfhgjp39c9q7nyzlgcmps3xx6a5r"))))
346 (build-system haskell-build-system)
347 (home-page "http://hackage.haskell.org/package/parallel")
348 (synopsis "Parallel programming library")
350 "This package provides a library for parallel programming.")
353 (define-public ghc-text
357 (outputs '("out" "doc"))
362 "http://hackage.haskell.org/package/text/text-"
367 "004p1c74crs8wmjafwsmw3mmycspq1j8fpm1lvfpq6acha7bnpc6"))))
368 (build-system haskell-build-system)
370 `(#:tests? #f)) ; FIXME: currently missing libraries used for tests.
371 (home-page "https://github.com/bos/text")
373 "Efficient packed Unicode text type library.")
375 "An efficient packed, immutable Unicode text type (both strict and
376 lazy), with a powerful loop fusion optimization framework.
378 The 'Text' type represents Unicode character strings, in a time and
379 space-efficient manner. This package provides text processing
380 capabilities that are optimized for performance critical use, both
381 in terms of large data quantities and high speed.")
384 (define-public ghc-hashable
386 (name "ghc-hashable")
388 (outputs '("out" "doc"))
393 "http://hackage.haskell.org/package/hashable/hashable-"
398 "0h9295pv2sgbaqlwpwbx2bap6nngm0jcdhkqham1wpjwyxqgqrlc"))))
399 (build-system haskell-build-system)
401 `(#:tests? #f)) ; FIXME: currently missing libraries used for tests.
402 ;; these inputs are necessary to use this library
404 `(("ghc-text" ,ghc-text)))
405 (home-page "http://github.com/tibbe/hashable")
407 "Class for types that can be converted to a hash value")
409 "This package defines a class, 'Hashable', for types that can be
410 converted to a hash value. This class exists for the benefit of hashing-based
411 data structures. The package provides instances for basic types and a way to
412 combine hash values.")
415 (define-public ghc-hunit
419 (outputs '("out" "doc"))
424 "http://hackage.haskell.org/package/HUnit/HUnit-"
429 "0hcs6qh8bqhip1kkjjnw7ccgcsmawdz5yvffjj5y8zd2vcsavx8a"))))
430 (build-system haskell-build-system)
431 (home-page "http://hunit.sourceforge.net/")
432 (synopsis "Unit testing framework for Haskell")
434 "HUnit is a unit testing framework for Haskell, inspired by the
435 JUnit tool for Java.")
438 (define-public ghc-random
442 (outputs '("out" "doc"))
447 "http://hackage.haskell.org/package/random/random-"
451 (base32 "0nis3lbkp8vfx8pkr6v7b7kr5m334bzb0fk9vxqklnp2aw8a865p"))))
452 (build-system haskell-build-system)
453 (home-page "http://hackage.haskell.org/package/random")
454 (synopsis "Random number library")
455 (description "This package provides a basic random number generation
456 library, including the ability to split random number generators.")
459 (define-public ghc-primitive
461 (name "ghc-primitive")
463 (outputs '("out" "doc"))
468 "http://hackage.haskell.org/package/primitive/primitive-"
473 "05gdgj383xdrdkhxh26imlvs8ji0z28ny38ms9snpvv5i8l2lg10"))))
474 (build-system haskell-build-system)
476 "https://github.com/haskell/primitive")
477 (synopsis "Primitive memory-related operations")
479 "This package provides various primitive memory-related operations.")
482 (define-public ghc-tf-random
484 (name "ghc-tf-random")
486 (outputs '("out" "doc"))
491 "http://hackage.haskell.org/package/tf-random/tf-random-"
495 (base32 "0445r2nns6009fmq0xbfpyv7jpzwv0snccjdg7hwj4xk4z0cwc1f"))))
496 (build-system haskell-build-system)
497 ;; these inputs are necessary to use this package
499 `(("ghc-primitive" ,ghc-primitive)
500 ("ghc-random" ,ghc-random)))
501 (home-page "http://hackage.haskell.org/package/tf-random")
502 (synopsis "High-quality splittable pseudorandom number generator")
503 (description "This package contains an implementation of a high-quality
504 splittable pseudorandom number generator. The generator is based on a
505 cryptographic hash function built on top of the ThreeFish block cipher. See
506 the paper \"Splittable Pseudorandom Number Generators Using Cryptographic
507 Hashing\" by Claessen, Pałka for details and the rationale of the design.")
510 (define-public ghc-quickcheck
512 (name "ghc-quickcheck")
514 (outputs '("out" "doc"))
519 "http://hackage.haskell.org/package/QuickCheck/QuickCheck-"
524 "04xs6mq22bcnkpi616qrbm7jlivh9csnhmvjgp1ifq52an1wr4rx"))))
525 (build-system haskell-build-system)
527 `(#:tests? #f ; FIXME: currently missing libraries used for tests.
528 #:configure-flags '("-f base4")))
529 ;; these inputs are necessary to use this package
531 `(("ghc-tf-random" ,ghc-tf-random)))
533 "https://github.com/nick8325/quickcheck")
535 "Automatic testing of Haskell programs")
537 "QuickCheck is a library for random testing of program properties.")
540 (define-public ghc-case-insensitive
542 (name "ghc-case-insensitive")
544 (outputs '("out" "doc"))
549 "http://hackage.haskell.org/package/case-insensitive/case-insensitive-"
554 "07nm40r9yw2p9qsfp3pjbsmyn4dabrxw34p48171zmccdd5hv0v3"))))
555 (build-system haskell-build-system)
557 `(("ghc-hunit" ,ghc-hunit)))
558 ;; these inputs are necessary to use this library
560 `(("ghc-text" ,ghc-text)
561 ("ghc-hashable" ,ghc-hashable)))
563 `(#:tests? #f)) ; FIXME: currently missing libraries used for tests.
565 "https://github.com/basvandijk/case-insensitive")
566 (synopsis "Case insensitive string comparison")
568 "The module 'Data.CaseInsensitive' provides the 'CI' type constructor
569 which can be parameterised by a string-like type like: 'String', 'ByteString',
570 'Text', etc.. Comparisons of values of the resulting type will be insensitive
574 (define-public ghc-syb
578 (outputs '("out" "doc"))
583 "http://hackage.haskell.org/package/syb/syb-"
588 "11sc9kmfvcn9bfxf227fgmny502z2h9xs3z0m9ak66lk0dw6f406"))))
589 (build-system haskell-build-system)
591 `(("ghc-hunit" ,ghc-hunit)
592 ("ghc-mtl" ,ghc-mtl)))
594 "http://www.cs.uu.nl/wiki/GenericProgramming/SYB")
595 (synopsis "Scrap Your Boilerplate")
597 "This package contains the generics system described in the
598 /Scrap Your Boilerplate/ papers (see
599 <http://www.cs.uu.nl/wiki/GenericProgramming/SYB>).
600 It defines the 'Data' class of types permitting folding and unfolding
601 of constructor applications, instances of this class for primitive
602 types, and a variety of traversals.")
605 (define-public ghc-containers
607 (name "ghc-containers")
609 (outputs '("out" "doc"))
614 "http://hackage.haskell.org/package/containers/containers-"
619 "1kcd55nl0vzi99i8sr8fmc5j25fv7m0a9hd3nihnq1pd64pfciqn"))))
620 (build-system haskell-build-system)
622 `(("ghc-hunit" ,ghc-hunit)
623 ("ghc-quickcheck" ,ghc-quickcheck)))
625 `(#:tests? #f)) ; FIXME: currently missing libraries used for tests.
626 (home-page "http://hackage.haskell.org/package/containers")
627 (synopsis "Assorted concrete container types")
629 "This package contains efficient general-purpose implementations of
630 various basic immutable container types. The declared cost of each operation
631 is either worst-case or amortized, but remains valid even if structures are
635 (define-public ghc-fgl
639 (outputs '("out" "doc"))
644 "http://hackage.haskell.org/package/fgl/fgl-"
649 "0rcmz0xlyr1wj490ffja29z1jgl51gz19ka609da6bx39bwx7nga"))))
650 (build-system haskell-build-system)
651 (inputs `(("ghc-mtl" ,ghc-mtl)))
652 (home-page "http://web.engr.oregonstate.edu/~erwig/fgl/haskell")
654 "Martin Erwig's Functional Graph Library")
655 (description "The functional graph library, FGL, is a collection of type
656 and function definitions to address graph problems. The basis of the library
657 is an inductive definition of graphs in the style of algebraic data types that
658 encourages inductive, recursive definitions of graph algorithms.")
661 (define-public ghc-unordered-containers
663 (name "ghc-unordered-containers")
665 (outputs '("out" "doc"))
670 "http://hackage.haskell.org/package/unordered-containers/unordered-containers-"
675 "06l1xv7vhpxly75saxdrbc6p2zlgz1az278arfkz4rgawfnphn3f"))))
676 (build-system haskell-build-system)
678 `(("ghc-hunit" ,ghc-hunit)
679 ("ghc-quickcheck" ,ghc-quickcheck)))
680 ;; these inputs are necessary to use this library
681 (propagated-inputs `(("ghc-hashable" ,ghc-hashable)))
683 `(#:tests? #f)) ; FIXME: currently missing libraries used for tests.
685 "https://github.com/tibbe/unordered-containers")
687 "Efficient hashing-based container types")
689 "Efficient hashing-based container types. The containers have been
690 optimized for performance critical use, both in terms of large data quantities
694 (define-public ghc-split
698 (outputs '("out" "doc"))
703 "http://hackage.haskell.org/package/split/split-"
708 "0xa3j0gwr6k5vizxybnzk5fgb3pppgspi6mysnp2gwjp2dbrxkzr"))))
709 (build-system haskell-build-system)
711 `(("ghc-quickcheck" ,ghc-quickcheck)))
712 (home-page "http://hackage.haskell.org/package/split")
714 "Combinator library for splitting lists")
715 (description "A collection of various methods for splitting lists into
716 parts, akin to the 'split' function found in several mainstream languages.")
719 (define-public ghc-parsec
723 (outputs '("out" "doc"))
728 "http://hackage.haskell.org/package/parsec/parsec-"
732 (base32 "1ja20cmj6v336jy87c6h3jzjp00sdbakwbdwp11iln499k913xvi"))))
733 (build-system haskell-build-system)
735 `(("ghc-hunit" ,ghc-hunit)))
736 ;; these inputs are necessary to use this library
738 `(("ghc-text" ,ghc-text)
739 ("ghc-mtl" ,ghc-mtl)))
741 `(#:tests? #f)) ; FIXME: currently missing libraries used for tests.
743 "https://github.com/aslatter/parsec")
744 (synopsis "Monadic parser combinators")
745 (description "Parsec is a parser library. It is simple, safe, well
746 documented, has extensive libraries, good error messages, and is fast. It is
747 defined as a monad transformer that can be stacked on arbitrary monads, and it
748 is also parametric in the input stream type.")
751 (define-public ghc-vector
754 (version "0.10.12.2")
755 (outputs '("out" "doc"))
760 "http://hackage.haskell.org/package/vector/vector-"
765 "01hc71k1z9m0g0dv4zsvq5d2dvbgyc5p01hryw5c53792yi2fm25"))))
766 (build-system haskell-build-system)
768 `(("ghc-quickcheck" ,ghc-quickcheck)))
769 ;; these inputs are necessary to use this library
771 `(("ghc-primitive" ,ghc-primitive)))
773 `(#:tests? #f)) ; FIXME: currently missing libraries used for tests.
774 (home-page "https://github.com/haskell/vector")
775 (synopsis "Efficient Arrays")
776 (description "An efficient implementation of Int-indexed arrays (both
777 mutable and immutable), with a powerful loop optimisation framework.")
780 (define-public ghc-network
784 (outputs '("out" "doc"))
789 "http://hackage.haskell.org/package/network/network-"
794 "12b7saam5ga6l4cplgkad49xa4vkynz2ri9jxidx1cxiqjcl0vc4"))))
795 (build-system haskell-build-system)
797 `(("ghc-hunit" ,ghc-hunit)))
799 `(#:tests? #f ; FIXME: currently missing libraries used for tests.
801 (modify-phases %standard-phases
802 (add-before configure set-sh
803 (lambda _ (setenv "CONFIG_SHELL" "sh"))))))
804 (home-page "https://github.com/haskell/network")
805 (synopsis "Low-level networking interface")
807 "This package provides a low-level networking interface.")
810 (define-public ghc-network-uri
812 (name "ghc-network-uri")
814 (outputs '("out" "doc"))
819 "http://hackage.haskell.org/package/network-uri/network-uri-"
824 "09ymamb128jgqghpda4nixncr73all8qc6q53976aricm6a27p37"))))
825 (build-system haskell-build-system)
827 `(("ghc-hunit" ,ghc-hunit)
828 ("ghc-network" ,ghc-network)))
830 `(#:tests? #f)) ; FIXME: currently missing libraries used for tests.
832 `(("ghc-parsec" ,ghc-parsec)))
834 "https://github.com/haskell/network-uri")
835 (synopsis "Labrary for URI manipulation")
836 (description "This package provides an URI manipulation inteface. In
837 'network-2.6' the 'Network.URI' module was split off from the 'network'
838 package into this package.")
841 ;;; haskell.scm ends here