[GHC] #10837: Constant-time indexing of closed type family axioms
GHC
ghc-devs at haskell.org
Thu Sep 3 20:34:48 UTC 2015
#10837: Constant-time indexing of closed type family axioms
-------------------------------------+-------------------------------------
Reporter: jstolarek | Owner:
Type: task | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 7.11
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: Compile-time
Unknown/Multiple | performance bug
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Revisions: |
-------------------------------------+-------------------------------------
Right now `CoAxiom` stores a list of `CoAxBranch`es in a `BranchList`. But
it would be useful to actually have a constant-time indexing into axioms.
One code fragment when I really wanted to have this feature is in
`TcValidity.checkValidCoAxiom`:
{{{#!hs
-- Replace n-th element in the list. Assumes 0-based indexing.
replace_br :: [CoAxBranch] -> Int -> CoAxBranch -> [CoAxBranch]
replace_br brs n br = take n brs ++ [br] ++ drop (n+1) brs
}}}
I believe this code could be rewritten in a much more efficient way using
constant-time indexing.
The new data structure should most likely have a type that indicates
whether the axiom is branched or not.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10837>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list