Refinement hole fits don't include suggestions from other (prerequisite) typeclasses.
Summary
Hole fits don't include suggestions from other (prerequisite) typeclasses.
Steps to reproduce
module Typeclasses where
data Tree a = Leaf a | Node (Tree a) (Tree a)
deriving (Eq,Show)
instance Functor Tree where
fmap f (Leaf a) = Leaf $ f a
fmap f (Node a b) = Node (fmap f a) (fmap f b)
instance Applicative Tree where
pure = Leaf
(Leaf f) <*> x = _ --fmap f x
(Node f g) <*> x = Node (f <*> x) (g <*> x)
Compiled with ghc tests/Typeclasses.hs -frefinement-level-hole-fits=3 -fno-max-refinement-hole-fits
Suggests Leaf, (<*>), Node, pure, id, head, last, asTypeOf, (!!)
Expected behavior
Since fmap f x
or f <$> x
is typecorrect, I would expect it to show up. Both because fmap for Tree is defined above, and because Functor is a prerequisite of Applicative.
Environment
- GHC version used: Glasgow Haskell Compiler, Version 8.9.0.20190705, stage 2 booted by GHC version 8.6.5