Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Backports:SLE-15
ghc-directory-tree
ghc-directory-tree.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ghc-directory-tree.spec of Package ghc-directory-tree
# # spec file for package ghc-directory-tree # # 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 pkg_name directory-tree %bcond_with tests Name: ghc-%{pkg_name} Version: 0.12.1 Release: 0 Summary: A simple directory-like tree datatype, with useful IO functions License: BSD-2-Clause Group: Development/Libraries/Haskell 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-directory-devel BuildRequires: ghc-filepath-devel BuildRequires: ghc-rpm-macros %if %{with tests} BuildRequires: ghc-process-devel %endif %description A simple directory-like tree datatype, with useful IO functions and Foldable and Traversable instance Provides a simple data structure mirroring a directory tree on the filesystem, as well as useful functions for reading and writing file and directory structures in the IO monad. Importing the library and optional (useful) Foldable and Traverable libraries: > import System.Directory.Tree > import qualified Data.Foldable as F > import qualified Data.Traversable as T Write a hand-made directory tree of textfiles (strings) to the disk. Simulates creating a new user Tux's home directory on a unix machine: > writeDirectory$ "/home" :/ Dir "Tux" [File "README" "Welcome!"] "read" a directory by opening all the files at a filepath with readFile, returning an 'AnchoredDirTree String' (d2). Then check for any IO failures: > do (base :/ d2) <- readDirectory "../parent_dir/dir2/" > let failed = anyFailed d2 > if failed then ... Use Foldable instance function to concat a directory 'dir' of text files into a single file under the same directory: > do (b :/ dt) <- readDirectory dir > let f = F.concat dt > return$ b :/ File "ALL_TEXT" f Open all the files in the current directory as lazy bytestrings, ignoring the base path in Anchored wrapper: > import qualified Data.ByteString.Lazy as B > do (_ :/ dTree) <- readDirectoryWith B.readFile "./" This version also offers an experimental function `readDirectoryWithL` that does lazy directory IO, allowing you to treat the returned `DirTree` as if it were a normal lazily-generated data structure. For example, the following does only the amount of IO necessary to list the file names of the children of the root directory, similar to "ls /": > do d <- readDirectoryWithL readFile "/" > mapM_ (putStrLn . name) $ contents $ free d Any ideas or suggestions for improvements are most welcome :-) /CHANGES/: from 0.11 - export 'System.Directory.Tree.transformDir' as requested - add test suite to cabal file - remove redundant 'removeNonexistent' (thanks to dmwit for patch) . %package devel Summary: Haskell %{pkg_name} library development files Group: Development/Libraries/Haskell 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 %doc LICENSE %files devel -f %{name}-devel.files %doc EXAMPLES %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor