The foundation package

[Tags:bsd3, library, test]

A custom prelude with no dependencies apart from base.

This package has the following goals:


[Skip to Readme]

Properties

Versions 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.0.11, 0.0.12, 0.0.13
Change log CHANGELOG.md
Dependencies base (>=4.7 && <5), ghc-prim, Win32 [details]
License BSD3
Copyright 2015-2017 Vincent Hanquez <vincent@snarc.org> 2017 Foundation Maintainers
Author Vincent Hanquez <vincent@snarc.org>
Maintainer vincent@snarc.org
Category foundation
Home page https://github.com/haskell-foundation/foundation
Bug tracker https://github.com/haskell-foundation/foundation/issues
Source repository head: git clone https://github.com/haskell-foundation/foundation.git
Uploaded Sat Jul 8 09:27:24 UTC 2017 by VincentHanquez
Distributions Arch:0.0.13, LTSHaskell:0.0.13, NixOS:0.0.13, Stackage:0.0.13, Tumbleweed:0.0.12
Downloads 22687 total (5734 in the last 30 days)
Votes
3 []
Status Docs available [build log]
Last success reported on 2017-07-08 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Flags

NameDescriptionDefaultType
experimentalEnable building experimental features, known as highly unstable or without good support cross-platformDisabledManual
bench-allAdd some comparaison benchmarks against other haskell librariesDisabledManual
minimal-depsBuild fully with minimal deps (no criterion, no quickcheck, no doctest)DisabledManual
bounds-checkAdd extra friendly boundary check for unsafe array operationsDisabledManual
doctestAdd extra friendly boundary check for unsafe array operationsDisabledManual

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for foundation

Readme for foundation-0.0.13

Foundation

Linux Build Status Windows Build Status Doc Stackage version Hackage version BSD3 Haskell Coverage Status

Documentation:

Goals

  • provide a base like set of modules that provide a consistent set of features and bugfixes across multiple versions of GHC (unlike base).
  • provide a better and more efficient prelude than base's prelude.
  • be self-sufficient: no external dependencies apart from base (or ghc packages).
  • provide better data-types: packed unicode string by default, arrays.
  • Better numerical classes that better represent mathematical things (No more all-in-one Num).

Usage

How to use with the normal Prelude

Add the foundation package in your cabal file, and it's recommended to import Foundation qualified if you're planning to use with the normal Prelude:

For example:

import qualified Foundation as F

It's also recommended if you're going to deal with packages using text, bytestring, vector.. to use the foundation-edge package.

How to use fully without Prelude

Disable the built-in prelude at the top of your file:

{-# LANGUAGE NoImplicitPrelude #-}

Or directly in your project cabal file:

Default-Extensions: NoImplicitPrelude

Then in your modules:

import Foundation

Advanced settings

Please check out the chapter Advanced Usage Options in the documentation.

How to contribute

Contribution guide can be found here.

Profiling

If you want to see the core (simpl step) or the assembly (asm step), then you can build with

stack build --ghc-options -ddump-simpl --ghc-options -ddump-asm

Note that it doesn't actually will create the necessary extra files if the modules doesn't need building.

you can then find your build by-products in:

.stack-work/dist/<architecture>/Cabal-<CabalVersion>/build/

Each modules that get compiled will create an equivalent file in the build directory:

  • ModuleName.dump-simpl
  • ModuleName.dump-asm

For profiling individual programs, the following command is useful:

stack ghc -- -O --make X.hs -prof -auto-all -caf-all -fforce-recomp

Benchmarking

To get the list of benchmark:

stack bench --benchmark-arguments -l

To compare against other libraries, you need to set the bench-all flag

stack bench --flag foundation:bench-all --benchmark-arguments -l

To run a specific or set of benchmarks :

stack bench --flag foundation:bench-all --benchmark-arguments 'types/String/SplitAt/mascii-10/Text'
stack bench --flag foundation:bench-all --benchmark-arguments '-m prefix types/String/SplitAt'
stack bench --flag foundation:bench-all --benchmark-arguments '-m glob types/String/SplitAt'

To register a set of benchmarks:

stack bench --flag foundation:bench-all --benchmark-arguments "--csv $(git describe).csv"

Design

Foundation started on the simple idea of trying to put everything I need in one simple and consistent package. The amazing haskell ecosystem is extremely fragmented and maintained by different people with different goals, free time, and style. The overall scare of not trying to change anything relatively central (base, bytestring, text, vector, ...) for a promise of stability has pushed many people to work on their own thing, leading to unnecessary work duplication and further fragmentation.

Foundation uses and abuses type families.

Code Organisation

Every foundation modules start by Foundation.

  • Foundation is the prelude replacement module.
  • Foundation.Internal contains only compatibilty and re-export from ghc/ghc-prim/base.
  • Foundation.Primitive is where all the lowlevel magic happens:
    • Important types that underpins many others part
    • Pervasive features