[GHC] #9948: Recommend class constraint instead of instance constraint
GHC
ghc-devs at haskell.org
Mon Jan 26 04:46:58 UTC 2015
#9948: Recommend class constraint instead of instance constraint
-------------------------------------+-------------------------------------
Reporter: crockeea | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.4
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by crockeea):
Replying to [comment:7 rwbarton]:
> I can see why you might want this behavior in some cases, but would you
really want
>
> {{{
> isPalindrome :: [a] -> Bool
> isPalindrome xs = xs == reverse xs
> }}}
>
> to suggest adding an `Eq [a]` constraint (that's not even valid Haskell
98!), or some function to dump a data structure to suggest adding a `Show
[(Int, Maybe a)]` constraint?
I see your point on these examples. How's the feature request for GHC
mind-reading coming along?
> I'm also a bit confused by the workaround that you mentioned; if you
know that `Foo` is the class containing `foo` (which you must to comment
out its instances) then don't you already know what constraint to add? Is
it very difficult in your use cases to work out what the parameter to the
class should be?
Yes, it should be pretty obvious which constraint I need. The only minor
point I could make is that it isn't always immediately clear if the
function you are using is top-level or a method. The only way to resolve
that is to look at some documentation.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9948#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list