[GHC] #7989: "No constructor has all these fields" message can be improved
GHC
ghc-devs at haskell.org
Tue Jun 25 12:02:22 CEST 2013
#7989: "No constructor has all these fields" message can be improved
---------------------------------+------------------------------------------
Reporter: akio | Owner:
Type: feature request | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 7.7
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: Other
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by akio):
I updated the patch.
Replying to [comment:7 simonpj]:
> OK.... It's not easy to understand that code! Maybe it would be worth a
few more named intermediate values, with types, and a comment?
I did this.
>
> You could produce a very big set when a very small set exists, couldn't
you?
Yes, the size of the set is only bounded by the number of constructors.
>
> Could you ameliorate that as follows? Use `T` to mean the data type of
the first field in `rbinds`.
> * Sort the `membership` list in order of increasing number of `True`
fields. So the earlier fields `f` in the list have few `T` constructors
that have field `f`.
> * Now a field with a different type will be right at the front of the
list.
> * And the `(&&)` process will terminate more quickly because of all the
`False` items.
I implemented this. However I'm afraid that the worst-case behavior of the
algorithm hasn't changed much. Given a datatype with 2N constructors and
2N fields, it can find a set of N fields even though there is one with
just 2 fields. (an example is when the constructor ```i``` has the field
```j``` iff ```mod (i + j) (2*N) < N```)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7989#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list