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/247/head
Evan Borden 2019-06-23 19:31:05 -05:00 committed by GitHub
parent 56f93ba3bb
commit 988d5b4353
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 3 deletions

View File

@ -130,3 +130,13 @@ func = do
hello hello
|] |]
pure True 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,15 @@ layoutExpr lexpr@(L _ expr) = do
HsRecFld{} -> do HsRecFld{} -> do
-- TODO -- TODO
briDocByExactInlineOnly "HsRecFld" lexpr briDocByExactInlineOnly "HsRecFld" lexpr
HsOverLabel{} -> do #if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
-- TODO HsOverLabel _ext _reboundFromLabel name ->
briDocByExactInlineOnly "HsOverLabel{}" lexpr #elif MIN_VERSION_ghc(8,2,0) /* ghc-8.2 8.4 */
HsOverLabel _reboundFromLabel name ->
#else /* ghc-8.0 */
HsOverLabel name ->
#endif
let label = FastString.unpackFS name
in docLit . Text.pack $ '#' : label
HsIPVar{} -> do HsIPVar{} -> do
-- TODO -- TODO
briDocByExactInlineOnly "HsOverLabel{}" lexpr briDocByExactInlineOnly "HsOverLabel{}" lexpr