data-embed alternatives and similar packages
Based on the "Data" category.
Alternatively, view data-embed alternatives based on common mentions on social networks and blogs.
-
lens
Lenses, Folds, and Traversals - Join us on web.libera.chat #haskell-lens -
semantic-source
Parsing, analyzing, and comparing source code across many languages -
code-builder
Packages for defining APIs, running them, generating client code and documentation. -
text
Haskell library for space- and time-efficient operations over Unicode text. -
unordered-containers
Efficient hashing-based container types -
compendium-client
Mu (μ) is a purely functional framework for building micro services. -
cassava
A CSV parsing and encoding library optimized for ease of use and high performance -
holmes
A reference library for constraint-solving with propagators and CDCL. -
binary
Efficient, pure binary serialisation using ByteStrings in Haskell. -
primitive
This package provides various primitive memory-related operations. -
resource-pool
A high-performance striped resource pooling implementation for Haskell -
discrimination
Fast linear time sorting and discrimination for a large class of data types -
reflection
Reifies arbitrary Haskell terms into types that can be reflected back into terms -
dependent-sum
Dependent sums and supporting typeclasses for comparing and displaying them -
IORefCAS
A collection of different packages for CAS based data structures. -
audiovisual
Extensible records, variants, structs, effects, tangles -
dependent-map
Dependently-typed finite maps (partial dependent products) -
text-icu
This package provides the Haskell Data.Text.ICU library, for performing complex manipulation of Unicode text. -
orgmode-parse
Attoparsec parser combinators for parsing org-mode structured text! -
streaming
An optimized general monad transformer for streaming applications, with a simple prelude of functions -
safecopy
An extension to Data.Serialize with built-in version control -
uuid-types
A Haskell library for creating, printing and parsing UUIDs -
scientific
Arbitrary-precision floating-point numbers represented using scientific notation
Clean code begins in your IDE with SonarLint
Do you think we are missing an alternative of data-embed or a related project?
README
data-embed
Library and executable for packing files into Haskell executables and accessing said files.
Usage
In order to access files embedded in an executable, you need to use the
functions from the Data.Embed
module.
import Data.Embed
main = print (embeddeddFile' "my_file.txt")
Packing files into Haskell source is not currently supported, so you will need
to compile your program. You will also want to create my_file.txt
so we
have something to play with.
$ ghc --make my_prog.hs
$ echo -n "Hello!" > my_file.txt
Now use the included embedtool
program to pack my_file.txt
into
my_prog
.
$ embedtool -w my_prog my_file.txt
Finally, run your program.
$ ./my_prog
"Hello!"
You can also recursively embed entire directories into your executable.
The --replace
switch indicates that we want to overwrite any previous data
bundle attached to the executable we're writing to.
$ mkdir my_data_dir
$ mv my_file.txt my_data_dir/
$ embedtool -w --replace my_prog my_data_dir
However, if we now try to run the program, we get an error.
$ ./my_prog
my_prog: no such embedded file: `my_file.txt'
To figure out why, we list all files embedded in my_prog
.
$ embedtool -l my_prog
my_data_dir/my_file.txt
Aha! As far as the application is concerned, the file is no longer called
my_file.txt
, but my_data_dir/my_file.txt
! While this is useful if we want
to embed multiple files with the same name but in different directories, it
can also be annoying, like in this case. Fortunately, we can control how many
leading directories are included in file names using the -p
option to
embedtool
, once again fixing our example.
$ embedtool -w --replace -p1 my_prog my_data_dir
$ embedtool -l my_prog
my_data_dir/my_file.txt
$ ./my_prog
"Hello!"
This will strip one leading directory from the names of all added files. If a file name would "disappear" entirely due to directory stripping, that file is not embedded in the executable:
$ embedtool -w --replace -p2 my_prog my_data_dir
The above command would strip two leading directories from all included file
names, but my_data_dir/my_file.txt
has only one, and so would not be embedded:
$ embedtool -l my_prog
$ ./my_prog
my_prog: no such embedded file: `my_file.txt'
For more usage instructions, try embedtool --help
. A Haskell API to the
functionality of embedtool
is also included in the Data.Embed.File
module.