logo
首页技术栈工具库讨论
GenericPretty
GenericPretty
GenericPretty is a Haskell library that supports automatic derivation of pretty printing functions on user defined data types. The form of geenrics used is based on that introduced in the paper: Magalhaes, Dijkstra, Jeuring, and Loh, A Generic Deriving Mechanism for Haskell, 3'rd ACM Symposium on Haskell, pp. 37-48, September 2010, http://dx.doi.org/10.1145/1863523.1863529. Changes from the original paper in the GHC implementation are described here: http://www.haskell.org/haskellwiki/GHC.Generics#Changes_from_the_paper. This package requires the use of the new GHC.Generics features http://www.haskell.org/haskellwiki/GHC.Generics, present from GHC 7.2. Use of these features is indicated by the DeriveGeneric pragma. or the flag -XDeriveGeneric. Pretty printing produces values of type Text.PrettyPrint.Doc, using the Text.PrettyPrint library http://www.haskell.org/ghc/docs/latest/html/libraries/pretty-1.1.1.0/Text-PrettyPrint.html. The output provided is a pretty printed version of that provided by Prelude.show. That is, rendering the document provided by this pretty printer yields an output identical to that of Prelude.show, except for extra whitespace. For information about the functions exported by the package please see the API linked further down this page. For examples of usage, both basic and more complex see the README file and the haskell source code files in the TestSuite folder, both included in the package. Finally for installation instructions also see the README file or this page: http://www.haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package
hsenv
hsenv
hsenv is a tool (inspired by Python's virtualenv) to create isolated Haskell environments. It creates a sandboxed environment in a .hsenv/ sub-directory of your project, which, when activated, allows you to use regular Haskell tools (ghc, ghci, ghc-pkg, cabal) to manage your Haskell code and environment. It's possible to create an environment, that uses different GHC version than your currently installed. Very simple emacs integration mode is included. Basic usage First, choose a directory where you want to keep your sandboxed Haskell environment, usually a good choice is a directory containing your cabalized project (if you want to work on a few projects (perhaps an app and its dependent library), just choose any of them, it doesn't really matter). Enter that directory: Next, create your new isolated Haskell environment (this is a one time only (per environment) step): Now, every time you want to use this environment, you have to activate it: That's it! Now it's possible to use all regular Haskell tools like usual, but it won't affect your global/system's Haskell environment, and also your per-user environment (from ~.cabal and ~.ghc) will stay the same. All cabal-installed packages will be private to this environment, and also the external environments (global and user) will not affect it (this environment will only inherit very basic packages, mostly ghc and Cabal and their deps). When you're done working with this environment, enter command deactivate_hsenv, or just close the current shell (with exit). Named vs Unnamed Environments By default, hsenv creates an "unnamed" environment, but sometimes for particular use cases you might want to create different environments under the same directory. This is achievable creating a "named" environment. To do that, just pass the flag "--name=ENVIRONMENT_NAME" to hsenv: hsenv --name=ENVIRONMENT_NAME This will make hsenv to generate a folder of the form ".hsenv_ENVIRONMENT_NAME". Advanced usage. The only advanced usage is using different GHC version. This can be useful to test your code against different GHC version (even against nightly builds). First, download binary distribution of GHC for your platform (e.g. ghc-7.0.4-i386-unknown-linux.tar.bz2), then create a new environment using that GHC Then, proceed (with [de]activation) as in basic case. Fetching and downloading a remote version of GHC Recent versions of hsenv include the possibility to automatically download and install a GHC version directly from the GHC main repository. To do that, as regards the example above, all you need to do is to pass the desired version of GHC you want to install: Or a valid URL pointing to a compressed GHC archive: Misc hsenv has been tested on i386 Linux and FreeBSD systems, but it should work on any Posix platform. External (from tarball) GHC feature requires binary GHC distribution compiled for your platform, that can be extracted with tar and installed with "./configure --prefix=PATH; make install". For more info please consult "hsenv --help" or the attached README file.