File ghc-ghc-heap-view.spec of Package ghc-ghc-heap-view
#
# spec file for package ghc-ghc-heap-view
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#
%global without_prof 1
%global pkg_name ghc-heap-view
%bcond_with tests
Name: ghc-%{pkg_name}
Version: 0.5.9
Release: 0
Summary: Extract the heap representation of Haskell values and thunks
License: BSD-3-Clause
Group: Development/Languages/Other
Url: https://hackage.haskell.org/package/%{pkg_name}
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-binary-devel
BuildRequires: ghc-bytestring-devel
BuildRequires: ghc-containers-devel
BuildRequires: ghc-ghc-devel
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-template-haskell-devel
BuildRequires: ghc-transformers-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if %{with tests}
BuildRequires: ghc-deepseq-devel
%endif
%description
This library provides functions to introspect the Haskell heap, for example to
investigate sharing and lazy evaluation. As this is tied to the internals of
the compiler, it only works with specific versions. Currently, GHC 7.4 through
7.10 should be supported.
It has been inspired by (and taken code from) the vacuum package and the GHCi
debugger, but also allows to investigate thunks and other closures.
This package also provides a new GHCi-command, ':printHeap', which allows you
to inspect the current heap representation of a value, including sharing and
cyclic references. To enable the command, you need to load the included ghci
script or add it to '~/.ghci', as explained by 'cabal install'. Once it is set
up, you can do this:
>> let value = "A Value" >> let x = (value, if head value == 'A' then value
else "", cycle [True, False]) >> :printHeap x >let x1 = _bco > x21 = [] >in
(x1,_bco,_bco) >> length (take 100 (show x)) `seq` return () -- evaluate
everything >> :printHeap x >let x1 = "A Value" > x16 = True : False : x16 >in
(x1,x1,x16)
You can change the maximum recursion depth using ':setPrintHeapDepth':
>> :setPrintHeapDepth 3 >> :printHeap x >let x1 = C# 'A' : ... : ...
>in (x1,x1,True : ... : ...)
If the view is impaired by blackholes (written '_bh'), running
'System.Mem.performGC' usually helps.
The work on this package has been supported by the Deutsche Telekom Stiftung
(<http://telekom-stiftung.de>).
%package devel
Summary: Haskell %{pkg_name} library development files
Group: Development/Libraries/Other
Requires: %{name} = %{version}-%{release}
Requires: ghc-compiler = %{ghc_version}
Requires(post): ghc-compiler = %{ghc_version}
Requires(postun): ghc-compiler = %{ghc_version}
%description devel
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
%check
%cabal_test
%post devel
%ghc_pkg_recache
%postun devel
%ghc_pkg_recache
%files -f %{name}.files
%defattr(-,root,root,-)
%doc LICENSE
%dir %{_datadir}/%{pkg_name}-%{version}
%{_datadir}/%{pkg_name}-%{version}/ghci
%files devel -f %{name}-devel.files
%defattr(-,root,root,-)
%changelog