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

GHC ghc-devs at haskell.org
Sun Jun 4 11:05:32 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:                    |
-------------------------------------+-------------------------------------

Comment (by zaoqi):

 Replying to [comment:1 ezyang]:
 > 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!)

 What's CPS?

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


More information about the ghc-tickets mailing list