buildable: Typeclass for builders of linear data structures
Various linear data structures can be expensive to construct in a
repetitive fashion. For example, to append a single value to the end
of a list is O(n)
, and as such doing so repeatedly is recommended
against.
As such, to efficiently construct such structures we have the notion of a builder. This can be used to more efficiently prepend and append values, and at the end we "run" the builder to construct the overall value.
This module provides an abstraction over various builders for specific data structures. It also aims to minimise the number of functions required to add various values to the builder by using a typeclass and newtype wrappers.
To construct a value from it's builder:
Start with either
for an emptymempty
Builder
, or if you have an initial value use
.fromValue
Add initial values to the front or back using
prepend
/<|
orappend
/|>
respectively.Once you've finished constructing your builder, create your final value with
build
.
Note: all instances are defined for both strict and lazy
ByteString
and Text
values.
Downloads
- buildable-0.1.0.3.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3 |
---|---|
Change log | changelog |
Dependencies | base (>=4.6 && <4.8), bytestring (>=0.10.0.0 && <0.11), containers (>=0.5 && <0.6), dlist (>=0.5 && <0.8), text (>=0.11.3.0 && <1.3) [details] |
License | MIT |
Author | Ivan Lazar Miljenovic |
Maintainer | Ivan.Miljenovic@gmail.com |
Category | Data |
Source repo | head: darcs get http://hub.darcs.net/ivanm/buildable |
Uploaded | by IvanMiljenovic at 2015-03-10T09:58:42Z |
Distributions | |
Reverse Dependencies | 1 direct, 0 indirect [details] |
Downloads | 3331 total (2 in the last 30 days) |
Rating | (no votes yet) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Last success reported on 2015-03-10 [all 1 reports] |