[commit: ghc] master: Add OverloadedLists, allowing list syntax to be overloaded (3234a4a)

Johan Tibell johan.tibell at gmail.com
Thu Feb 14 16:39:35 CET 2013


Did we end up supporting a length hint so we can efficiently create e.g.
vectors that need upfront allocation of the space before writing the
elements? Or is the plan to do like we for String and have literals desugar
to e.g.

fromIntList# :: Int# -> Ptr Int# -> [Int]

intList# :: Ptr Int#
intList# = [1,2,3,4]#

myliteral = fromList (fromIntList# 4 intList#)

On Thu, Feb 14, 2013 at 6:56 AM, Simon Peyton Jones
<simonpj at microsoft.com>wrote:

> Repository : ssh://darcs.haskell.org//srv/darcs/ghc
>
> On branch  : master
>
>
> http://hackage.haskell.org/trac/ghc/changeset/3234a4ade7204c4206831b4c1dc4a8b23624cc6b
>
> >---------------------------------------------------------------
>
> commit 3234a4ade7204c4206831b4c1dc4a8b23624cc6b
> Author: Simon Peyton Jones <simonpj at microsoft.com>
> Date:   Thu Feb 14 13:04:14 2013 +0000
>
>     Add OverloadedLists, allowing list syntax to be overloaded
>
>     This work was all done by
>        Achim Krause <achim.t.krause at gmail.com>
>        George Giorgidze <giorgidze at gmail.com>
>        Weijers Jeroen <jeroen.weijers at uni-tuebingen.de>
>
>     It allows list syntax, such as [a,b], [a..b] and so on, to be
>     overloaded so that it works for a variety of types.
>
>     The design is described here:
>         http://hackage.haskell.org/trac/ghc/wiki/OverloadedLists
>
>     Eg. you can use it for maps, so that
>             [(1,"foo"), (4,"bar")] :: Map Int String
>
>     The main changes
>      * The ExplicitList constructor of HsExpr gets witness field
>      * Ditto ArithSeq constructor
>      * Ditto the ListPat constructor of HsPat
>
>     Everything else flows from this.
>
>  compiler/deSugar/Check.lhs        |   15 ++--
>  compiler/deSugar/Coverage.lhs     |   16 +++-
>  compiler/deSugar/DsArrows.lhs     |    2 +-
>  compiler/deSugar/DsExpr.lhs       |   42 +++++++----
>  compiler/deSugar/DsMeta.hs        |    7 +-
>  compiler/deSugar/Match.lhs        |   31 ++++++--
>  compiler/hsSyn/Convert.lhs        |    6 +-
>  compiler/hsSyn/HsExpr.lhs         |   12 ++-
>  compiler/hsSyn/HsPat.lhs          |   12 ++-
>  compiler/hsSyn/HsUtils.lhs        |    6 +-
>  compiler/main/DynFlags.hs         |    2 +
>  compiler/parser/Parser.y.pp       |   12 ++--
>  compiler/parser/RdrHsSyn.lhs      |    4 +-
>  compiler/prelude/PrelNames.lhs    |   26 ++++++-
>  compiler/prelude/TysWiredIn.lhs   |    2 +-
>  compiler/rename/RnEnv.lhs         |   18 +++--
>  compiler/rename/RnExpr.lhs        |   45 +++++++----
>  compiler/rename/RnPat.lhs         |   21 ++++-
>  compiler/typecheck/TcExpr.lhs     |  111 ++++++++++++++++----------
>  compiler/typecheck/TcHsSyn.lhs    |   30 ++++++--
>  compiler/typecheck/TcHsType.lhs   |    2 +-
>  compiler/typecheck/TcPat.lhs      |   14 +++-
>  compiler/typecheck/TcRnDriver.lhs |    2 +-
>  compiler/typecheck/TcRnTypes.lhs  |    2 +
>  compiler/utils/Outputable.lhs     |    4 +-
>  docs/users_guide/flags.xml        |    7 ++
>  docs/users_guide/glasgow_exts.xml |  157
> +++++++++++++++++++++++++++++++++++++
>  27 files changed, 469 insertions(+), 139 deletions(-)
>
>
> Diff suppressed because of size. To see it, use:
>
>     git show 3234a4ade7204c4206831b4c1dc4a8b23624cc6b
>
> _______________________________________________
> ghc-commits mailing list
> ghc-commits at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130214/02db1f84/attachment.htm>


More information about the ghc-devs mailing list