foundation: Alternative prelude with batteries and no dependencies

[ bsd3, foundation ] [ Propose Tags ]

A custom prelude with no dependencies apart from base.

This package has the following goals:

  • provide a base like sets 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.

  • provide better data-types: packed unicode string by default, arrays.

  • Better numerical classes that better represent mathematical thing (No more all-in-one Num).

  • Better I/O system with less Lazy IO

  • Usual partial functions distinguished through type system


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
bench-all

Add some comparaison benchmarks against other haskell libraries

Disabled
bounds-check

Add extra friendly boundary check for unsafe array operations

Disabled
Automatic Flags
NameDescriptionDefault
experimental

Enable building experimental features, known as highly unstable or without good support cross-platform

Disabled

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

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 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, 0.0.14, 0.0.15, 0.0.16, 0.0.17, 0.0.18, 0.0.19, 0.0.20, 0.0.21, 0.0.22, 0.0.23, 0.0.24, 0.0.25, 0.0.26, 0.0.26.1, 0.0.27, 0.0.28, 0.0.29, 0.0.30
Dependencies base (>=4.6 && <4.11), ghc-prim, Win32 [details]
License BSD-3-Clause
Copyright Vincent Hanquez <vincent@snarc.org>
Author Vincent Hanquez <vincent@snarc.org>
Maintainer vincent@snarc.org
Revised Revision 2 made by phadej at 2018-04-03T17:11:07Z
Category foundation
Home page https://github.com/haskell-foundation/foundation
Bug tracker https://github.com/haskell-foundation/foundation/issues
Source repo head: git clone https://github.com/haskell-foundation/foundation
Uploaded by VincentHanquez at 2017-04-16T08:08:26Z
Distributions Arch:0.0.30, Debian:0.0.25, Fedora:0.0.30, LTSHaskell:0.0.30, NixOS:0.0.30, Stackage:0.0.30
Reverse Dependencies 17 direct, 3848 indirect [details]
Downloads 109158 total (286 in the last 30 days)
Rating 2.25 (votes: 4) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-04-16 [all 1 reports]

Readme for foundation-0.0.7

[back to package description]

Foundation

Build Status Coverage Status BSD Haskell

Documentation: foundation on hackage

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

Any contributions is welcome, but a short list includes:

  • Improve the code base
  • Report an issue
  • Fix an issue
  • Improve the documentation
  • Make tutorial on how to use foundation
  • Make your project use foundation instead of base, report the missing coverage (IO, types, etc.), or what functionality is missing to make a succesful transition

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