[GHC] #8912: Documentation stale: implicit-parameter constraints seem to be allowed in instance declarations now.

#8912: Documentation stale: implicit-parameter constraints seem to be allowed in instance declarations now. -------------------------------------+------------------------------------- Reporter: andreas.abel | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Documentation | Version: 7.6.3 Keywords: implicit- | Operating System: Unknown/Multiple parameter instance-constraints | Type of failure: Documentation Architecture: Unknown/Multiple | bug Difficulty: Easy (less than 1 | Test Case: hour) | Blocking: Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/other-type- extensions.html#implicit-parameters says: You can't have an implicit parameter in the context of a class or instance declaration. For example, both these declarations are illegal: {{{ class (?x::Int) => C a where ... instance (?x::a) => Foo [a] where ... }}} However, ghc 7.6.3 seems to accept this now: {{{ {-# LANGUAGE ImplicitParams #-} class C a where toInt :: a -> Int instance (?imp :: Int) => C [a] where toInt _ = ?imp test :: Int test = let ?imp = 5 in toInt "Hello, world" }}} test evaluates to 5. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8912 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8912: Documentation stale: implicit-parameter constraints seem to be allowed in
instance declarations now.
-------------------------------------+-------------------------------------
Reporter: andreas.abel | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Documentation | Version: 7.6.3
Resolution: | Keywords: implicit-
Operating System: Unknown/Multiple | parameter instance-constraints
Type of failure: Documentation | Architecture: Unknown/Multiple
bug | Difficulty: Easy (less than 1
Test Case: | hour)
Blocking: | Blocked By:
| Related Tickets:
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#8912: Documentation stale: implicit-parameter constraints seem to be allowed in instance declarations now. -------------------------------------+------------------------------------- Reporter: andreas.abel | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Documentation | Version: 7.6.3 Resolution: | Keywords: implicit- Operating System: Unknown/Multiple | parameter instance-constraints Type of failure: Documentation | Architecture: Unknown/Multiple bug | Difficulty: Easy (less than 1 Test Case: | hour) Blocking: | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => merge Comment: Quite right. The user manual is right! Fixed. I guess it's worth merging this if poss Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8912#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8912: Documentation stale: implicit-parameter constraints seem to be allowed in instance declarations now. -------------------------------------+------------------------------------- Reporter: andreas.abel | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Documentation | Version: 7.6.3 Resolution: fixed | Keywords: implicit- Operating System: Unknown/Multiple | parameter instance-constraints Type of failure: Documentation | Architecture: Unknown/Multiple bug | Difficulty: Easy (less than 1 Test Case: | hour) Blocking: | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: Merged. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8912#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8912: Documentation stale: implicit-parameter constraints seem to be allowed in instance declarations now. -------------------------------------+------------------------------------- Reporter: andreas.abel | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Documentation | Version: 7.6.3 Resolution: fixed | Keywords: implicit- Operating System: Unknown/Multiple | parameter instance-constraints Type of failure: Documentation | Architecture: Unknown/Multiple bug | Difficulty: Easy (less than 1 Test Case: | hour) Blocking: | Blocked By: | Related Tickets: -------------------------------------+------------------------------------- Comment (by andreas.abel): Ah, too bad, I thought this feature had been implemented. Seemed to work, though. Cheers, A -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8912#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8912: Documentation stale: implicit-parameter constraints seem to be allowed in instance declarations now. -------------------------------------+------------------------------------- Reporter: | Owner: andreas.abel | Status: closed Type: bug | Milestone: Priority: normal | Version: 7.6.3 Component: | Keywords: implicit- Documentation | parameter instance-constraints Resolution: fixed | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: | Blocked By: Documentation bug | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by dimitris): But it's a useful feature, although arguably a bit dangerous to use ... For instance I am working with a library that someone else has written that exposes only a type-class based interface, i.e. you provide instances of certain classes. Now these classes provide -- sadly -- only a functional interface, so the only way for me to parameterize my instance implementation is to use a class instance context. But if that context can't itself be an implicit parameter or its instances depend on an implicit parameter then it's pretty impossible to reconfigure my code! So I think there is a pretty compelling case to /omit/ that check and perhaps warn users that this may lead to unpredictable behaviour. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8912#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC