[GHC] #7495: generalizing overloaded list syntax to Sized Lists, HLists, HRecords, etc

GHC ghc-devs at haskell.org
Wed Jun 10 04:32:30 UTC 2015


#7495: generalizing overloaded list syntax to Sized Lists, HLists, HRecords, etc
-------------------------------------+-------------------------------------
        Reporter:  nwf               |                   Owner:  carter
            Type:  feature request   |                  Status:  new
        Priority:  normal            |               Milestone:  7.12.1
       Component:  Compiler          |                 Version:  7.6.1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:  #9883             |                Blocking:  9883
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by carter):

 hrm, thats an intersting take

 the analogous design I was playing with was

 {{{#!hs

 class HetCons (f:: k -> * ) (f':: m -> * ) (h :: * ) (tl:: k) (res :: m)
           | f-> f', f'-> f
             ,f h tl -> res , f h res -> tl, f res tl -> h
             , f' res -> h
             , f  tl res  -> h
             , f'  tl res -> h

                  where
   hcons :: h  -> f tl -> f' res


 class HetNil nil where  -- (f:: k -> * ) (a :: k)  where
   hnil :: nil


 }}}

 i have a few example instances in
 https://github.com/cartazio/HetList/blob/master/HetList.hs, and type
 inference would work out pretty nicely.

 one idea that i dont think we've articulated or explored properly is
 understanding how to use pattern synonym machinery to overload pattern
 matching list syntax or something!

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


More information about the ghc-tickets mailing list