Re: [GHC] #13783: 更合理的instance Monad []

GHC ghc-devs at haskell.org
Sat Jun 3 13:04:10 UTC 2017


#13783: 更合理的instance Monad []
-------------------------------------+-------------------------------------
        Reporter:  zaoqi             |                Owner:  (none)
            Type:  feature request   |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Core Libraries    |              Version:  8.0.1
      Resolution:  wontfix           |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by ezyang):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 In English, the reporter is suggesting that the Monad instance of list be
 rewritten so that it generates a fairer distribution of tuples (in the
 example above, all tuples generated are of the form `(x, 1)`). The
 fairness of these types of nondeterminism monads is indeed something that
 has been investigated in the past (e.g.,
 http://okmij.org/ftp/Computation/LogicT.pdf). Unfortunately, the semantics
 of the List monad as defined in Haskell are fairly set in stone at this
 point, and can't be changed without massively breaking existing code. The
 best course of action is probably to define your own monad with the
 necessary fairness (do consider using CPS; it's a lot more efficient!)

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


More information about the ghc-tickets mailing list