The bookkeeper package

[Tags:benchmark, bsd3, library, program, test]

Please see README.md


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.1.0, 0.1.2.0, 0.2.0.0, 0.2.1.0, 0.2.1.1, 0.2.2.0, 0.2.3, 0.2.4
Change log CHANGELOG.md
Dependencies base (==4.9.*), bookkeeper, data-default-class, markdown-unlit, type-level-sets [details]
License BSD3
Copyright (c) Julian K. Arni
Author Julian K. Arni
Maintainer jkarni@gmail.com
Category Data Structures, Records
Home page http://github.com/turingjump/bookkeeper#readme
Bug tracker https://github.com/turingjump/bookkeeper/issues
Source repository head: git clone https://github.com/turingjump/bookkeeper
Uploaded Wed Dec 7 12:29:14 UTC 2016 by jkarni
Distributions NixOS:0.2.4
Downloads 302 total (39 in the last 30 days)
Votes
0 []
Status Docs not available [build log]
All reported builds failed as of 2016-12-07 [all 3 reports]

Modules

  • Bookkeeper
    • Bookkeeper.Internal
      • Bookkeeper.Internal.Errors
    • Bookkeeper.Lens

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for bookkeeper

Readme for bookkeeper-0.2.4

Bookkeeper

Bookkeeper is a new Haskell library that uses the new OverlodaedLabels feature of GHC 8 to provide a new take on datatypes and records:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE OverloadedLabels #-}
import Bookkeeper


jane :: Book '[ "name" :=> String, "age" :=> Int ]
jane = emptyBook
     & #name =: "Jane"
     & #age =: 30

-- >>> jane
-- Book {age = 30, name = "Jane"}
-- >>> jane ?: #name
-- "Jane"

It bears some similarities to Nikita Volkov's record library, but requires no Template Haskell.

Accesing a field that does not exist is a type error, made nicer with GHCs new custom type errors:

 -- >>> jane ?: #address
--   • The provided Book does not contain the field "address"
--     Book type:
--     '["age" ':-> Int, "name" ':-> String]

The order in which fields are inserted or appear in types does not matter. That is, in:

-- type A = Book '[ "field1" :=> Int,  "field2" :=> Bool]
-- type B = Book '[ "field2" :=> Bool, "field1" :=> Int ]

Types A and B are the same.

You can set, modify, or get fields. See the haddocks for more information.

main :: IO ()
main = return ()