HatAna.hs revision e9458b1a7a19a63aa4c179f9ab20f4d50681c168
11N/AModule : ./Haskell/HatAna.hs
11N/ALicense : GPLv2 or higher, see LICENSE.txt
11N/Aimport Haskell.HatParser hiding (hatParser)
11N/Aimport Haskell.PreludeString
553N/Aimport Common.AS_Annotation
553N/Aimport Common.Result
11N/Aimport Common.Doc
11N/Aimport Common.DocUtils
import Common.ExtSign
import Data.List
import Data.Char
import qualified Data.Set as DSet
import Data.Maybe (fromMaybe)
, types :: Map.Map (HsIdentI PNT) (Kind, TypeInfo PNT)
, values :: Map.Map (HsIdentI PNT) (Scheme PNT)
, fixities :: Map.Map (HsIdentI (SN String)) HsFixity
, Map.keysSet $ fixities a, length $ instances a)
, Map.keysSet $ fixities b, length $ instances b)
, types = types e1 `Map.difference` types e2
, values = values e1 `Map.difference` values e2
, fixities = fixities e1 `Map.difference` fixities e2
, types = types e1 `Map.union` types e2
, values = values e1 `Map.union` values e2
, scope = scope e1 `DSet.union` scope e2
, fixities = fixities e1 `Map.union` fixities e2
(if Map.null ts then empty else
[ a :>: b | (a, b) <- Map.toList ts ])) $+$
(if Map.null vs then empty else
[ a :>: b | (a, b) <- Map.toList vs ])) $+$
(if Map.null fs then empty else
| (a, b) <- Map.toList fs ]) $+$
, types = Map.fromList [ (a, b) | (a :>: b) <- ts ]
, values = Map.fromList [ (a, b) | (a :>: b) <- vs ]
, fixities = Map.fromList fs
, types = Map.empty
, values = Map.empty
, fixities = Map.empty
osc = scope e `DSet.union` insc
rm = reAssocModule wm [(mod_Prelude, Map.toList fixMap)] parsedMod
. extendts [ a :>: b | (a, b) <- Map.toList $ values e ]
. extendkts [ a :>: b | (a, b) <- Map.toList $ types e ]
getHsDecl = Data.Maybe.fromMaybe (HsFunBind loc0 []) . basestruct . struct
HsTypeSig _ ts _ _ -> any (flip Set.member preludeValues . pp) ts
HsTypeDecl _ ty _ -> Set.member (pp $ definedType ty) preludeTypes
HsDataDecl _ _ ty cs _ -> Set.member (pp $ definedType ty) preludeTypes
Set.member s preludeValues || prefixed s
in Set.member s preludeConstrs
preludeValues :: Set.Set String
preludeValues = Set.fromList $ filter (not . prefixed) $ map pp
$ Map.keys $ values preludeSign
preludeConstrs :: Set.Set String
Set.filter ( \ s -> not (null s) && isUpper (head s)) preludeValues
preludeTypes :: Set.Set String