Comments (5)
I agree, I was thinking about adding groups today.
from weigh.
I like this direction. I'll try applying it today or tomorrow and see how it scales. Presumably nesting works correctly too?
from weigh.
I have started to look at it. I come to something like:
data ToWeight = Simple String Action | Group String [ToWeight]
-- | Weigh specification monad.
newtype Weigh a =
Weigh {runWeigh :: State (Config, [ToWeight]) a}
deriving (Monad,Functor,Applicative)
[...]
-- | Write out an action.
tellAction :: String -> Action -> Weigh ()
tellAction name action = Weigh $ modify $ second $ \x -> x ++ [Simple name action]
wgroup :: String -> Weigh () -> Weigh ()
wgroup str wei = do
start <- Weigh get
let startL = length $ snd start
wei
Weigh $ modify $ second $ \x -> take startL x ++ [Group str $ drop startL x]
Not very beautiful, but I think this can do the trick. There can be a syntax like:
mainWith $ do
wgroup "fst" $ do
func "1" f 1
func "2" f 2
wgroup "snd" $ do
func "3" f 3
from weigh.
Great :D
I can't see why nested wgroup will not work, but this definitely needs to be tested ^^
from weigh.
Implemented! http://hackage.haskell.org/package/weigh-0.0.8/docs/Weigh.html#v:wgroup
from weigh.
Related Issues (20)
- Measured bytes differs from what is reported by a cost center HOT 4
- Test failure (due to GHC 8.2.2?) HOT 2
- 0.0.6 Fails to compile with GHC-7.8 HOT 2
- Can't build test suite with ghc 8.4 due to bytestring-trie HOT 2
- Why direct build-depend on TemplateHaskell ? HOT 4
- Error when using with criterion HOT 5
- Export reportGroup HOT 3
- Problem when running Actions whith the same name in different group
- Doesn't build with GHC head HOT 1
- Inconsistent result, bytes in negative HOT 11
- Meaning of "Live" column different for GHC versions 8.2 and later HOT 1
- Results depending on function ordering HOT 5
- Implementation of 'fork' HOT 3
- Maximum residency isn't right HOT 4
- setting file does not exists and empty results HOT 6
- mainWith cannot be used more than once HOT 3
- Somewhat confusing results HOT 4
- Build failures in weigh-0.0.1 to weigh-0.0.5 with recent GHC versions HOT 1
- Build failures with mtl-2.3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weigh.