Giter VIP home page Giter VIP logo

vault's Introduction

Build Status

Vault is a tiny library that provides a single data structure called vault.

A vault is a type-safe, persistent storage for values of arbitrary types. Like IORef, I want to be able to store values of any type in it, but unlike IORef, I want the storage space to behave like a persistent, first-class data structure, as appropriate for a purely functional language.

It is analogous to a bank vault, where you can access different bank boxes with different keys; hence the name.

In other words, a vault is an abstract data type with the following basic signature

data Key a
data Vault

newKey :: IO (Key a)
empty  :: Vault
lookup :: Key a -> Vault -> Maybe a
insert :: Key a -> a -> Vault -> Vault
delete :: Key a -> Vault -> Vault

A few common functions for finite maps, like adjust and union, are provided as well.

This library was created thanks to the feedback on my blog post Vault - a persistent store for values of arbitrary types.

Installation

The whole thing is available on hackage, so you just have to type

cabal update
cabal install vault

Feedback

Use the issue tracker or send an email to the maintainer.

vault's People

Contributors

andreasabel avatar changaco avatar clockfort avatar ehird avatar felixonmars avatar fumieval avatar heinrichapfelmus avatar ianbollinger avatar luite avatar mrkkrp avatar ryanglscott avatar sjakobi avatar snoyberg avatar tarrasch avatar thielema avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vault's Issues

Allow GHC 8.0

GHC 8.0 ships with base-4.9, which is disallowed by vault. A new release which can be used with GHC would be useful, and would allow me to test my downstream projects with GHC 8.0.

Variant that uses no GHC-specific extensions / functions

In an effort to make the reactive-banana library compile on UHC, I would like to include a variant of the vault package that doesn't use any GHC-specific functions. Of course, the best way to do this is to use the CPP preprocessor.

The only trouble is probably the ST monad which UHC likely doesn't have. However, I think that ST can be implemented in terms of unsafePerformIO, so it's easy to add it to the UHC libraries.

Is vault thread-safe?

I don't see this addressed anywhere in the docs, and I assume that it isn't thread-safe, but I just wanted to check.

Unclear dependency (instance Hashable Unique) makes reactive-banana build fail

I am unsure whether this is about reactive-banana or about vault. The issue originates here but shows in the other package.

Today, I manually installed packages into a fresh ghc-7.6.3 build to ultimately get a working reactive-banana package. The compiler is a custom version but corresponds to ghc-7.6.3 in functionality by default.

The manual installation was done using the following commands while standing in each package directory:
myGHC Setup.hs
./Setup configure --with-ghc=myGHC --global
./Setup build
./Setup register --inplace

Dependencies shown on hackage suggested the following installation order:
vault - text - hashable - unordered-containers - reactive-banana
This is wrong, as I found out later. The build of reactive-banana fails with error No instance for (Hashable Unique).
The vault cabal file specifies an additional vault dependency on hashable controlled by flag UseGHC (default true); if the flag is set, the instance will be declared. Rebuilding vault after the installation of hashable fixed the error, the build of reactive-banana went through.

So, where does a fix belong?
A fix inside reactive-banana would probably test the Hashable instance, but would not help users identify the issue. Better would be to make sure vault does not build with GHC when the flag was not unset explicitly. Ultimately, this might be a cabal issue? (too eagerly trying to install packages with flags that later create incompatibilities).

/ Jost

Support GHC-9.6

Revision 2 of version 0.3.1.5 on Hackage disallows base-4.18, which is the version of base shipped in GHC 9.6.1. It would be nice if this version was supported.

Export either Vault.Lazy or Vault.Strict as Vault, again

In vault-0.2 we had the module Data.Vault which was split into Data.Vault.Lazy and Data.Vault.Strict in vault-0.3. Can I have back a Data.Vault that re-exports either Data.Vault.Lazy and Data.Vault.Strict? This would be analogous to Data.Map that re-exports Data.Map.Lazy. It would both show the programmer the prefered Vault variant and allows him to support both vault-0.2 and vault-0.3 by importing Data.Vault.
However in order to allow simple version ranges like vault >=0.2 && <0.4 it would be necessary to deprecate vault-0.3 at Hackage.

Vault fails to install with Cabal 1.18.0.1

(It looks like it is a missing file in the vault package, "IO.hs")

cabal install vault
Resolving dependencies...
Configuring vault-0.3.0.1...
Building vault-0.3.0.1...
Preprocessing library vault-0.3.0.1...

src/Data/Vault/Lazy.hs:6:0:
fatal error: IO.hs: No such file or directory
compilation terminated.
Failed to install vault-0.3.0.1
cabal: Error: some packages failed to install:
vault-0.3.0.1 failed during the building phase. The exception was:
ExitFailure 1

GHC 9.8 compat

This seems to work, so a revision could be sufficient:

 % cabal get vault
Unpacking to vault-0.3.1.5/
 % cd vault-0.3.1.5 
 % cabal repl --allow-newer=vault:base

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.