Giter Site home page Giter Site logo

kowainik / containers-backpack Goto Github PK

View Code? Open in Web Editor NEW
32.0 11.0 7.0 60 KB

๐ŸŽ’ Backpack interface for containers

Home Page: https://kowainik.github.io/projects/containers-backpack

License: Mozilla Public License 2.0

Haskell 100.00%
haskell backpack containers data-structures signatures

containers-backpack's People

Contributors

b-mehta avatar chshersh avatar fintanh avatar karen avatar piq9117 avatar vrom911 avatar yigitozkavci 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

containers-backpack's Issues

Add `{-# INLINE #-}` pragmas to all instances

Some functions are reexported directly from the corresponding libraries. But most of them are implemented in our signatures. To improve performance, it's better to add {-# INLINE #-} pragma to every function.

So, for example, if we have:

singleton :: Key k => k -> v -> Map k v
singleton = HM.singleton

This should be written like this:

singleton :: Key k => k -> v -> Map k v
singleton = HM.singleton
{-# INLINE singleton #-}

And we should do this for every function in every instance.

Discuss separation on unit tests and property-based tests

Some tests introduced in #34 are unit tests and some are property-based tests. It would be really nice to somehow separate tests. For example, this one is unit test:

nullEmpty :: Bool
nullEmpty = null empty

But this looks like property-based test:

lookupMatchMember :: Key k => k -> [(k, v)] -> Bool
lookupMatchMember k (fromList -> m) = match (lookup k m) (member k m)
where
match :: Maybe v -> Bool -> Bool
match Nothing False = True
match Nothing True = False
match (Just _) False = False
match (Just _) True = True

I would love to have 3 test-suites:

  1. test-suite for unit tests
  2. test-suite for property tests
  3. One test suite that combines them all.

My proposal is to use hspec for unit tests. QuickCheck can be used now for property-based tests.

Think more about package naming

Currently packages have the following name:

  • map-sig: singatures for readonly maps
  • map-sig-extended: signatures for modifiable maps
  • map-containers-map: implementation of map-sig for Map.Lazy from containers package
  • map-containers-intmap: implementation of map-sig for IntMap.Lazy from containers package
  • map-unordered: implementation of map-sig for HashMap.Strict from unordered-containers
  • (future) map-primitive: implementaiton of map-sig for pritimitive-containers
  • map-contrib: different functions implemented using only map-sig package

map- prefix is not good because map-sig package also can have signatures for Set without any problems.

Any better suggestions?

Add default implementations of some functions

These functions can be put directly to containers-sig-* packages.

  • !? as an operator version of lookup
  • // for Map difference

For example, there's this useful operator:

infixl 9 !?
(!?) :: Key k => Map k v -> k -> Maybe v
(!?) m k = lookup k m

And probably there exist other useful functions with default implementations. We need to collect such functions and put them near signatures. Though, good naming for module is most difficult part here...

Trouble pulling in containers via github

Hi,

I believe I found the relevant docs for how to do this. However, I'm still running into trouble. My commit shows the relevant changes to the stack/cabal files, but note that some of the code changes are nonsense. However, it appears to fail before the code changes would cause a compilation failure:

stack build 
Progress 0/5            containers-sig-readonly-0.0.0: configure (lib)
Progress 0/5            containers-sig-0.0.0: configure (lib)
Progress 0/5            containers-sig-readonly-0.0.0: build (lib)
Progress 0/5            containers-sig-readonly-0.0.0: copy/register
Progress 0/5            Progress 1/5: containers-ordered-strict-0.0.0, containers-sig-0.0.0                                                                   containers-ordered-strict-0.0.0: configure (lib)
Progress 1/5: containers-ordered-strict-0.0.0, containers-sig-0.0.0                                                                   containers-sig-0.0.0: build (lib)
Progress 1/5: containers-ordered-strict-0.0.0, containers-sig-0.0.0                                                                   containers-sig-0.0.0: copy/register
Progress 1/5: containers-ordered-strict-0.0.0, containers-sig-0.0.0                                                                   Progress 2/5: containers-contrib-0.0.0, containers-ordered-strict-0.0.0                                                                       containers-contrib-0.0.0: configure (lib)
Progress 2/5: containers-contrib-0.0.0, containers-ordered-strict-0.0.0                                                                       containers-ordered-strict-0.0.0: build (lib)
Progress 2/5: containers-contrib-0.0.0, containers-ordered-strict-0.0.0                                                                       containers-ordered-strict-0.0.0: copy/register
Progress 2/5: containers-contrib-0.0.0, containers-ordered-strict-0.0.0                                                                       containers-contrib-0.0.0: build (lib)
Progress 2/5: containers-contrib-0.0.0, containers-ordered-strict-0.0.0                                                                       Progress 3/5: containers-contrib-0.0.0                                      containers-contrib-0.0.0: copy/register
Progress 3/5: containers-contrib-0.0.0                                      hico-0.1.0.0: configure (lib + exe)
Progress 3/5: containers-contrib-0.0.0                                      Progress 4/5: hico-0.1.0.0                          Configuring hico-0.1.0.0...
Progress 4/5: hico-0.1.0.0                          Error:
Progress 4/5: hico-0.1.0.0                              The following packages are broken because other packages they depend on are missing. These broken packages must be rebuilt before they can be used.
Progress 4/5: hico-0.1.0.0                          planned package hico-0.1.0.0 is broken due to missing package containers-contrib-0.0.0-CVCQxd4JzxzGeMuWdr5u0d+B3uxSMlrl2y2Er6UNvkdGh
Progress 4/5: hico-0.1.0.0                          
Progress 4/5: hico-0.1.0.0                          Completed 5 action(s).

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.