[GHC] #2496: Invalid Eq/Ord instances in Data.Version

GHC ghc-devs at haskell.org
Mon May 11 17:30:22 UTC 2015


#2496: Invalid Eq/Ord instances in Data.Version
-------------------------------------+-------------------------------------
        Reporter:  guest             |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:  7.12.1
       Component:  Core Libraries    |                 Version:  6.8.3
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:  Phab:D395
-------------------------------------+-------------------------------------

Comment (by ekmett):

 One reason for not following semver exactly is that the PVP doesn't line
 up exactly with semver. Both of our first two digits are "major", and we
 allow as many subsequent digits as we want. We also don't have an
 observable prerelease tag for better or worse.

 As for version tags being ignored by the `Eq` instance. That would have
 been a viable alternative, but it would have meant that `Version` still
 didn't line up with what we use it for in ghc, cabal, and elsewhere. IIRC
 the main use of the tags currently is to talk about a version "*" in some
 internals in places.

 A "structural" `Eq` has the benefit that `x == y` implies `f x == f y`,
 and doesn't require the user to track the exception to the semantics they
 expect for equality, whereas under your suggestion we'd lose that.

 It'd just be 'some place to shove extra stuff' bolted onto a data type
 that could be fundamentally simpler. Then if users want to work with a
 tagged version they can build it by one of several means, for whatever
 notions of tags they want to allow, using the existing `Version` type as a
 primitive component in their own tagged version type with tags being
 relevant or not for equality as they choose.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/2496#comment:22>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list