diff options
-rw-r--r-- | src/HaskellCodeExplorer/GhcUtils.hs | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/src/HaskellCodeExplorer/GhcUtils.hs b/src/HaskellCodeExplorer/GhcUtils.hs index 2a40213..4256641 100644 --- a/src/HaskellCodeExplorer/GhcUtils.hs +++ b/src/HaskellCodeExplorer/GhcUtils.hs @@ -86,6 +86,8 @@ import GHC.Driver.Session (DynFlags) import GHC.Data.FastString (mkFastString, unpackFS) import GHC ( DynFlags + , unXRec + , recordPatSynField #if MIN_VERSION_GLASGOW_HASKELL(8,6,1,0) , HsDocString #else @@ -499,25 +501,35 @@ hsGroupVals hsGroup = #endif _ -> [] -hsPatSynDetails :: HsPatSynDetails a -> [a] +hsPatSynDetails :: HsPatSynDetails GhcRn -> [Name] hsPatSynDetails patDetails = -#if MIN_VERSION_GLASGOW_HASKELL(8,4,3,0) case patDetails of - InfixCon name1 name2 -> [name1, name2] - PrefixCon _ fields -> fields + InfixCon name1 name2 -> [unXRec name1, unXRec name2] + PrefixCon _ fields -> unXRec <$> fields RecCon fields -> concatMap - (\field -> [-- recordPatSynSelectorId field, - recordPatSynPatVar field]) - fields -#else - case patDetails of - InfixPatSyn name1 name2 -> [name1, name2] - PrefixPatSyn name -> name - RecordPatSyn fields -> - concatMap - (\field -> [recordPatSynSelectorId field, recordPatSynPatVar field]) + (\field -> [extFieldOcc $ recordPatSynField field, + unXRec $ recordPatSynPatVar field]) fields -#endif + +-- hsPatSynDetails :: HsPatSynDetails a -> [a] +-- hsPatSynDetails patDetails = +-- #if MIN_VERSION_GLASGOW_HASKELL(8,4,3,0) +-- case patDetails of +-- InfixCon name1 name2 -> [name1, name2] +-- PrefixCon _ fields -> fields +-- RecCon fields -> concatMap +-- (\field -> [-- recordPatSynSelectorId field, +-- recordPatSynPatVar field]) +-- fields +-- #else +-- case patDetails of +-- InfixPatSyn name1 name2 -> [name1, name2] +-- PrefixPatSyn name -> name +-- RecordPatSyn fields -> +-- concatMap +-- (\field -> [recordPatSynSelectorId field, recordPatSynPatVar field]) +-- fields +-- #endif #if MIN_VERSION_GLASGOW_HASKELL(8,4,3,0) |