The numerals package

[Tags:bsd3, library]

[Skip to Readme]

Properties

Versions 0.1, 0.3, 0.3.0.1, 0.4
Dependencies base (>=2), bytestring (>=0.9 && <1), dstring (<0.3), mtl (==1.1.*), pretty (>=1 && <1.1), text (==0.1.*) [details]
License BSD3
Copyright (c) 2009 Roel van Dijk, Bas van Dijk
Author Roel van Dijk <vandijk.roel@gmail.com>, Bas van Dijk <v.dijk.bas@gmail.com>
Maintainer Roel van Dijk <vandijk.roel@gmail.com>, Bas van Dijk <v.dijk.bas@gmail.com>
Stability experimental
Category Natural Language Processing, Numerical, Text
Uploaded Sun Apr 19 18:38:54 UTC 2009 by RoelVanDijk
Distributions NixOS:0.4
Downloads 842 total (23 in the last 30 days)
Votes
0 []
Status Docs uploaded by user
Build status unknown [no reports yet]

Modules

[Index]

Flags

NameDescriptionDefaultType
specialiseSpecialise the polymorphic language definitions to some often used types (String, ByteString, DString). Note that this increases compilation time and the size of the object files significantly. Also see READMEDisabledAutomatic

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 numerals

Readme for numerals-0.1

Specialise
==========

This is a small note on the Specialise flag.

All the language definitions (Text.Numeral.Language.*) are polymorphic
in their stringlike type. For example:

> nl :: (IsString s, Joinable s) => NumConfig s

This allows the user to choose whatever stringlike type she wants.

If you turn on the Specialise flag then specialised versions of the
language definitions will be build:

> #ifdef DO_SPECIALISE
> import qualified Data.ByteString as B
> import qualified Data.DString    as DS
>
> {-# SPECIALISE nl :: NumConfig String #-}
> {-# SPECIALISE nl :: NumConfig B.ByteString #-}
> {-# SPECIALISE nl :: NumConfig DS.DString #-}
> #endif

The idea is that user code which uses any of the specialised types
will become more efficient because the overloading overhead has been
removed. Of course if we specialise the library will take longer to
compile and will be bigger.

The following will discuss some actual numbers:

Without Specialise
==================

$ cabal configure

$ time cabal build
...
5.347s

$ du -b dist/build/libHSnumerals-0.1.a
605574	dist/build/libHSnumerals-0.1.a


With Specialise
===============

$ cabal configure --flags="Specialise"

$ time cabal build
...
14.779s

$ du -b dist/build/libHSnumerals-0.1.a
2064852	dist/build/libHSnumerals-0.1.a


Conclusion
=========

If we specialise then:
* compilation will take almost 3 times longer
* the library will be at least 3 times bigger

TODO: Check for peformance gains!