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
parent
56f93ba3bb
commit
988d5b4353
|
@ -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
|
||||
|
|
|
@ -55,9 +55,15 @@ layoutExpr lexpr@(L _ expr) = do
|
|||
HsRecFld{} -> do
|
||||
-- TODO
|
||||
briDocByExactInlineOnly "HsRecFld" lexpr
|
||||
HsOverLabel{} -> do
|
||||
-- TODO
|
||||
briDocByExactInlineOnly "HsOverLabel{}" lexpr
|
||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||
HsOverLabel _ext _reboundFromLabel name ->
|
||||
#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
|
||||
-- TODO
|
||||
briDocByExactInlineOnly "HsOverLabel{}" lexpr
|
||||
|
|
Loading…
Reference in New Issue