Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dimensional counters #22

Conversation

lucasdicioccio
Copy link

No description provided.

Breaking change: the Sample type now holds dimensions as key-value pairs.
@lucasdicioccio
Copy link
Author

This change breaks consumers of the API, and maybe some old GHC/Base versions. (Built with The Glorious Glasgow Haskell Compilation System, version 8.2.2).

I plan to wrap the new module with a type-fancy layer (either in this package or in another package) for a stronger guarantee that the dimensions passed to lookupOrCreate are correct (possibly saving a runtime check about dimension lengths).

Minimal compatibility patches to demonstrate the feature are provided for ekg-json and ekg.

The example works and displays individual curves flattening the dimensions as follows.
screen shot 2018-02-03 at 22 06 19

I'm more interested in providing support into ekg-core than ekg. Though, I don't mind doing a bit more. In particular, one annoying issue of my current design is the lack of "forced ordering" on the key/value pairs for the dimensions: thus preventing the ekg Snap layer to guess the HashMap key for retrieving a particular Sample value (but I'm not aware of users of this Snap route and I would suggest to drop the feature rather than complexifying the ekg-core logic for no users).

@lucasdicioccio
Copy link
Author

@tibbe any comment about this MR?

I'm willing to provide a typeful layer above this one to enforce more type-safety between the construction and consuming sides, though it should probably go in another package where we can allow stricter GHC versions.

Copy link
Collaborator

@tibbe tibbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@23Skidoo is the main reviewer now but I added some comments.

type Point = [Text]

data Dimensional a = Dimensional {
_create :: !(IO a)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please stick to the field naming pattern used for other data types (i.e. no leading underscore, but prefixed as needed).

type Label = Dimensional Label.Label
type Distribution = Dimensional Distribution.Distribution

example :: IO ()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This belongs in the examples/ directory and/or in some docs.

import Data.HashMap.Strict (HashMap, empty)
import qualified Data.HashMap.Strict as HashMap

type Name = Text
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of Haddoc docs needed here.

@@ -0,0 +1,88 @@
{-# LANGUAGE LambdaCase #-}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file needs some top-level Haddocks explaining how to use this module and what it's for.

@m-matth m-matth mentioned this pull request Nov 19, 2018
@23Skidoo
Copy link
Collaborator

Closing in favour of #32.

@23Skidoo 23Skidoo closed this Nov 19, 2018
@lucasdicioccio
Copy link
Author

Thanks @matth-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants