2015-02-02 19:12:13 +01:00
|
|
|
#
|
2015-10-04 19:03:19 +02:00
|
|
|
# spec file for package ghc-scientific
|
2015-02-02 19:12:13 +01:00
|
|
|
#
|
2016-07-03 12:20:13 +02:00
|
|
|
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
2015-02-02 19:12:13 +01:00
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
2015-03-29 11:48:43 +02:00
|
|
|
|
2015-02-02 19:12:13 +01:00
|
|
|
%global pkg_name scientific
|
2016-07-17 02:06:36 +02:00
|
|
|
%bcond_with tests
|
|
|
|
Name: ghc-%{pkg_name}
|
2016-07-22 09:42:04 +02:00
|
|
|
Version: 0.3.4.9
|
2015-02-02 19:12:13 +01:00
|
|
|
Release: 0
|
|
|
|
Summary: Numbers represented using scientific notation
|
|
|
|
License: BSD-3-Clause
|
2016-10-06 20:46:17 +02:00
|
|
|
Group: Development/Languages/Other
|
2016-07-17 02:06:36 +02:00
|
|
|
Url: https://hackage.haskell.org/package/%{pkg_name}
|
|
|
|
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
|
2015-02-02 19:12:13 +01:00
|
|
|
BuildRequires: ghc-Cabal-devel
|
2016-07-17 02:06:36 +02:00
|
|
|
BuildRequires: ghc-binary-devel
|
|
|
|
BuildRequires: ghc-bytestring-devel
|
|
|
|
BuildRequires: ghc-containers-devel
|
2015-02-02 19:12:13 +01:00
|
|
|
BuildRequires: ghc-deepseq-devel
|
|
|
|
BuildRequires: ghc-hashable-devel
|
2015-03-29 11:48:43 +02:00
|
|
|
BuildRequires: ghc-rpm-macros
|
2015-02-02 19:12:13 +01:00
|
|
|
BuildRequires: ghc-text-devel
|
2015-10-04 19:03:19 +02:00
|
|
|
BuildRequires: ghc-vector-devel
|
2016-07-17 02:06:36 +02:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
%if %{with tests}
|
|
|
|
BuildRequires: ghc-QuickCheck-devel
|
|
|
|
BuildRequires: ghc-smallcheck-devel
|
|
|
|
BuildRequires: ghc-tasty-ant-xml-devel
|
|
|
|
BuildRequires: ghc-tasty-devel
|
|
|
|
BuildRequires: ghc-tasty-hunit-devel
|
|
|
|
BuildRequires: ghc-tasty-quickcheck-devel
|
|
|
|
BuildRequires: ghc-tasty-smallcheck-devel
|
|
|
|
%endif
|
2015-02-02 19:12:13 +01:00
|
|
|
|
|
|
|
%description
|
2016-07-17 02:06:36 +02:00
|
|
|
'Data.Scientific' provides the number type 'Scientific'. Scientific numbers are
|
|
|
|
arbitrary precision and space efficient. They are represented using
|
|
|
|
<http://en.wikipedia.org/wiki/Scientific_notation scientific notation>.
|
|
|
|
The implementation uses a coefficient 'c :: 'Integer'' and a base-10 exponent
|
|
|
|
'e :: 'Int''. A scientific number corresponds to the 'Fractional' number:
|
|
|
|
''fromInteger' c * 10 '^^' e'.
|
|
|
|
|
|
|
|
Note that since we're using an 'Int' to represent the exponent these numbers
|
|
|
|
aren't truly arbitrary precision. I intend to change the type of the exponent
|
|
|
|
to 'Integer' in a future release.
|
|
|
|
|
|
|
|
The main application of 'Scientific' is to be used as the target of parsing
|
|
|
|
arbitrary precision numbers coming from an untrusted source. The advantages
|
|
|
|
over using 'Rational' for this are that:
|
|
|
|
|
|
|
|
* A 'Scientific' is more efficient to construct. Rational numbers need to be
|
|
|
|
constructed using '%' which has to compute the 'gcd' of the 'numerator' and
|
|
|
|
'denominator'.
|
|
|
|
|
|
|
|
* 'Scientific' is safe against numbers with huge exponents. For example:
|
|
|
|
'1e1000000000 :: 'Rational'' will fill up all space and crash your program.
|
|
|
|
Scientific works as expected:
|
2015-02-02 19:12:13 +01:00
|
|
|
|
2016-07-17 02:06:36 +02:00
|
|
|
> > read "1e1000000000" :: Scientific > 1.0e1000000000
|
2015-02-02 19:12:13 +01:00
|
|
|
|
2016-07-17 02:06:36 +02:00
|
|
|
* Also, the space usage of converting scientific numbers with huge exponents to
|
|
|
|
''Integral's' (like: 'Int') or ''RealFloat's' (like: 'Double' or 'Float') will
|
|
|
|
always be bounded by the target type.
|
|
|
|
|
|
|
|
%package devel
|
2015-02-02 19:12:13 +01:00
|
|
|
Summary: Haskell %{pkg_name} library development files
|
|
|
|
Group: Development/Libraries/Other
|
|
|
|
Requires: %{name} = %{version}-%{release}
|
|
|
|
Requires: ghc-compiler = %{ghc_version}
|
2016-07-17 02:06:36 +02:00
|
|
|
Requires(post): ghc-compiler = %{ghc_version}
|
|
|
|
Requires(postun): ghc-compiler = %{ghc_version}
|
2015-02-02 19:12:13 +01:00
|
|
|
|
2016-07-17 02:06:36 +02:00
|
|
|
%description devel
|
2015-02-02 19:12:13 +01:00
|
|
|
This package provides the Haskell %{pkg_name} library development files.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n %{pkg_name}-%{version}
|
|
|
|
|
|
|
|
%build
|
|
|
|
%ghc_lib_build
|
|
|
|
|
|
|
|
%install
|
|
|
|
%ghc_lib_install
|
|
|
|
|
2016-07-17 02:06:36 +02:00
|
|
|
%check
|
2016-07-22 09:42:04 +02:00
|
|
|
%cabal_test
|
2016-07-17 02:06:36 +02:00
|
|
|
|
|
|
|
%post devel
|
2015-02-02 19:12:13 +01:00
|
|
|
%ghc_pkg_recache
|
|
|
|
|
2016-07-17 02:06:36 +02:00
|
|
|
%postun devel
|
2015-02-02 19:12:13 +01:00
|
|
|
%ghc_pkg_recache
|
|
|
|
|
2016-07-17 02:06:36 +02:00
|
|
|
%files -f %{name}.files
|
|
|
|
%defattr(-,root,root,-)
|
2015-02-02 19:12:13 +01:00
|
|
|
%doc LICENSE
|
|
|
|
|
2016-07-17 02:06:36 +02:00
|
|
|
%files devel -f %{name}-devel.files
|
2015-02-02 19:12:13 +01:00
|
|
|
%defattr(-,root,root,-)
|
2016-07-17 02:06:36 +02:00
|
|
|
%doc changelog
|
2015-02-02 19:12:13 +01:00
|
|
|
|
|
|
|
%changelog
|