diff options
author | Yuchen Pei <hi@ypei.me> | 2022-05-31 18:35:07 +1000 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-05-31 18:35:07 +1000 |
commit | d769b9a431dfeed869244fa4d473e9f474c1b2ec (patch) | |
tree | 36b5e9c21d2962441b1f85731c3a771dcbfbc296 | |
parent | 69b26125f171df845de1f9d8029cd5a81da9592e (diff) |
fixing patsyn
-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) |