type annotations on the left cause ellipsis (...) cost centres in profiles
When defining a large multi-line subexpression in a where clause, I often write the type signature on the left side of the equals sign, so that the name and type are close together. This causes extra ellipsis ("
(...)") cost centres to appear in time & space profiles, making those profiles less useful.
Steps to reproduce
A minimal example from alp on #ghc: https://gist.github.com/alpmestan/66b32f20622160c74f4d4ffd24d518d8
A real-world example: showamt is shown by name but declaredprices is not. More precisely, that cost center, with source location
(121,5)-(128,43), is shown both as
pricesAtDate.declaredprices and as
pricesAtDate.(...), with only the latter having non-zero time/alloc/ticks/bytes.
If the type annotation is removed, or moved to the right hand side, the
(...) cost centres no longer appear in the profile.
A LHS-type-annotated subexpression should appear normally in the profile, without extra
(...) cost centres.
- GHC version used: 8.6.5
- Operating System: mac mojave
- System Architecture:
the essence of your problem seems to be that any PatBind gets treated this way. https://hackage.haskell.org/package/ghc-8.6.5/docs/HsBinds.html#v:PatBind and the note mentioned there should probably enlighten you