id summary reporter owner description type status priority milestone component version resolution keywords cc os architecture failure testcase blockedby blocking related differential wikipage
14858 Typed hole subtitution search fails in the REPL paf31 "It seems as though type class defaulting might be happening before the search.
This finds only undefined:
{{{#!text
> _traverse print ""abc""
:20:1: error:
• Found hole: _traverse :: (() -> IO ()) -> [Char] -> t
Where: ‘t’ is a rigid type variable bound by
the inferred type of it :: t
at :20:1-21
Or perhaps ‘_traverse’ is mis-spelled, or not in scope
• In the expression: _traverse
In the expression: _traverse print ""abc""
In an equation for ‘it’: it = _traverse print ""abc""
• Relevant bindings include it :: t (bound at :20:1)
Valid substitutions include
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
(imported from ‘Prelude’ (and originally defined in ‘GHC.Err’))
}}}
Annotating the return type helps, but we still don't find traverse_:
{{{#!text
> _traverse print ""abc"" :: IO ()
:22:1: error:
• Found hole: _traverse :: (() -> IO ()) -> [Char] -> IO ()
Or perhaps ‘_traverse’ is mis-spelled, or not in scope
• In the expression: _traverse
In the expression: _traverse print ""abc"" :: IO ()
In an equation for ‘it’: it = _traverse print ""abc"" :: IO ()
• Relevant bindings include
it :: IO () (bound at :22:1)
Valid substitutions include
mempty :: forall a. Monoid a => a
(imported from ‘Prelude’ (and originally defined in ‘GHC.Base’))
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
(imported from ‘Prelude’ (and originally defined in ‘GHC.Err’))
}}}
(note how print seems to have been defaulted to ())
Annotating the type of print helps:
{{{#!text
> _traverse (print :: Char -> IO ()) ""abc"" :: IO ()
:23:1: error:
• Found hole: _traverse :: (Char -> IO ()) -> [Char] -> IO ()
Or perhaps ‘_traverse’ is mis-spelled, or not in scope
• In the expression: _traverse
In the expression:
_traverse (print :: Char -> IO ()) ""abc"" :: IO ()
In an equation for ‘it’:
it = _traverse (print :: Char -> IO ()) ""abc"" :: IO ()
• Relevant bindings include
it :: IO () (bound at :23:1)
Valid substitutions include
mempty :: forall a. Monoid a => a
(imported from ‘Prelude’ (and originally defined in ‘GHC.Base’))
undefined :: forall (a :: TYPE r).
GHC.Stack.Types.HasCallStack =>
a
(imported from ‘Prelude’ (and originally defined in ‘GHC.Err’))
foldMap :: forall (t :: * -> *).
Foldable t =>
forall m a. Monoid m => (a -> m) -> t a -> m
(imported from ‘Prelude’
(and originally defined in ‘Data.Foldable’))
mapM_ :: forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
(imported from ‘Prelude’
(and originally defined in ‘Data.Foldable’))
traverse_ :: forall (t :: * -> *) (f :: * -> *) a b.
(Foldable t, Applicative f) =>
(a -> f b) -> t a -> f ()
(imported from ‘Data.Foldable’)
}}}
This was found with 8.4.1-rc.1." bug new normal 8.4.1 Compiler (Type checker) 8.4.1-alpha3 TypedHoles Unknown/Multiple Unknown/Multiple None/Unknown