[GHC] #9883: Make OverloadedLists more usable by splitting the class interface

GHC ghc-devs at haskell.org
Tue Dec 16 13:39:45 UTC 2014


#9883: Make OverloadedLists more usable by splitting the class interface
-------------------------------------+-------------------------------------
              Reporter:  muesli4     |            Owner:
                  Type:  feature     |           Status:  new
  request                            |        Milestone:  ⊥
              Priority:  normal      |          Version:  7.8.3
             Component:  External    |         Keywords:  overloaded lists,
  Core                               |  islist
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Moderate (less
  Unknown/Multiple                   |  than a day)
       Type of failure:              |       Blocked By:  7495
  None/Unknown                       |  Related Tickets:  #7495
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Replying to [comment:6 goldfire]:
 > Maybe I'm missing something basic, but why do we need classes at all
 here? I propose we just desugar the list to use some functions in scope,
 and if they don't type-check, that's the programmer's problem.

 What if you wanted to use list syntax for two different types in the same
 module?  You'd need two different `buildList` functions in scope.   Aha!
 Type classes would solve that!

 What if you wanted to use list syntax for a type constructor that is as-
 yet abstract.  Aha!  Type classes can do that too.

 Maybe you are saying "if you want to use type classes, then just import a
 module that defines `buildList` in a class".   And yes you could do that.
 But it's not the way ordinary list syntax or list comprehensions or monad
 do-notation work.  There they desugar to some ''specific'' functions; and
 you use `-XRebindableSyntax` if you want instead to use "whatever is in
 scope".  `-XOverloadedLists` works in a way consistent with that approach.

 Simon

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


More information about the ghc-tickets mailing list