
#15603: ref6 example from StaticPointers documentation doesn't type check -------------------------------------+------------------------------------- Reporter: mpickering | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): The `static show` example also doesn't produce an error exactly like the implied one. {{{ sp.hs:25:7: error: • No instance for (Typeable a0) arising from a static form • In the expression: static show In an equation for ‘foo’: foo = static show | 25 | foo = static show | ^^^^^^^^^^^ sp.hs:25:14: error: • Ambiguous type variable ‘a0’ arising from a use of ‘show’ prevents the constraint ‘(Show a0)’ from being solved. Relevant bindings include foo :: t0 (a0 -> String) (bound at sp.hs:25:1) Probable fix: use a type annotation to specify what ‘a0’ should be. These potential instances exist: instance Show (ST s a) -- Defined in ‘GHC.ST’ instance Show StaticPtrInfo -- Defined in ‘GHC.StaticPtr’ instance Show Ordering -- Defined in ‘GHC.Show’ ...plus 25 others ...plus 12 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the body of a static form: show In the expression: static show In an equation for ‘foo’: foo = static show | 25 | foo = static show | ^^^^ }}} Then adding a type signature leads to the confusing error: {{{ foo :: (Typeable a, Show a) => StaticPtr (a -> String) foo = static show }}} {{{ sp.hs:26:14: error: • No instance for (Show a) arising from a use of ‘show’ • In the body of a static form: show In the expression: static show In an equation for ‘foo’: foo = static show | 26 | foo = static show | }}} The user guide should discuss why these errors happen to help understanding. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15603#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler