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

#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 s9gf4ult): * Pattern matching: I believe we should not put pattern matching into `OverloadedLists` and stay with just list construction. It looks like implementation of generic list construction is simpler than generic pattern matching. The usability of list construction is higher because things like {{{#!hs [ OneTypeConstructor , OtherTypeConstructor , "string" ] }}} looks more clean and simple to write than {{{#!hs HCons OneTypeConstructor $ HCons OtherTypeConstructor $ HCons "string" HNil }}} but when you pattern match some list you probably expect some concrete list type, not just some list (heterogeneous or homogeneous) with some elements. Maybe add separate `OverloadedListPatterns` extension instead? * About `[a,b..c]`: There should nothing changed for homogeneous lists, but heterogeneous lists can not be constructed dynamically, especially lists like `[1..]`. Maybe it would be nice to make sugar `[a,b..f]` unwrap to {{{#!hs HCons a $ HCons b $ HCons c $ HCons e $ HCons f HNil }}} but it is not an option for homogeneous lists, especially lists like `[1,2..10000000]`. Maybe special syntax like `[1,2...5]` (three dots) for constructing heterogeneous lists at compile time? * I don't see any things which current `OverloadedLists` can do and this new can not. Maybe some issues with type inference ... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7495#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC