Skip to content

Lookup rules associated with functions/values in GHCI

It would be nice to have a way to look up in GHCi what rules can fire for a certain constant as the outmost symbol on the LHS. For example, something like

ghci> :pragmas map
{-# RULE "map"         [~1] forall f xs. map f xs = build (\c n -> foldr (mapFB c f) n xs) #-}
{-# RULE "map/coerce"  [1]               map coerce = coerce #-}

As the name suggests, I think we would also want to list applicable NOINLINE, INLINE, INLINABLE, CONLIKE, SPECIALIZE, etc pragmas too. This would simplify the process of debugging mis-firing rules.

If this isn't too difficult, I'd love to try implementing it. I've been looking for some way of contributing to GHC.

This initially came up here http://stackoverflow.com/q/38651602/3072788.

Trac metadata
Trac field Value
Version 8.0.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information