Add support for OverloadedLabels

`OverloadedLabels` is a simple enough extension to parse and format. It
is becoming more common with use of `generic-lens`. Since it can be
treated as a `HsVar` its implementation only requires using `docLit`,
along with some marshalling for dealing with `FastString`.
pull/244/head
Evan Rutledge Borden 2019-06-23 12:06:06 -05:00
parent 56f93ba3bb
commit 907f362ab5
2 changed files with 13 additions and 3 deletions

View File

@ -130,3 +130,13 @@ func = do
hello
|]
pure True
###############################################################################
## OverloadedLabels
#test bare label
{-# LANGUAGE OverloadedLabels #-}
foo = #bar
#test applied and composed label
{-# LANGUAGE OverloadedLabels #-}
foo = #bar . #baz $ fmap #foo xs

View File

@ -55,9 +55,9 @@ layoutExpr lexpr@(L _ expr) = do
HsRecFld{} -> do
-- TODO
briDocByExactInlineOnly "HsRecFld" lexpr
HsOverLabel{} -> do
-- TODO
briDocByExactInlineOnly "HsOverLabel{}" lexpr
HsOverLabel NoExt _reboundFromLabel name ->
let label = FastString.unpackFS name
in docLit . Text.pack $ '#' : label
HsIPVar{} -> do
-- TODO
briDocByExactInlineOnly "HsOverLabel{}" lexpr