git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #1942 from kRITZCREEK/psc-ide-cleanup

lots of formatting.

commit4d54a7d54aea9a648ccd226d4285cd08aa3d92d9 authorPhil Freeman <paf31@cantab.net> dateWed 9 Mar 2016, 18:53 (11 years ago) parent7fc9e1dd6a02ca
9 files changed+168−177
src/Language/PureScript/Ide/CaseSplit.hs−9 src/Language/PureScript/Ide/Completion.hs+4−4 src/Language/PureScript/Ide/Error.hs+11−12 src/Language/PureScript/Ide/Matcher.hs+6−6 src/Language/PureScript/Ide/Pursuit.hs+11−11 src/Language/PureScript/Ide/Reexports.hs+21−19 src/Language/PureScript/Ide/SourceFile.hs+37−36 src/Language/PureScript/Ide/State.hs+3−3 src/Language/PureScript/Ide/Types.hs+75−77
src/Language/PureScript/Ide/CaseSplit.hs−9
@@ -60,15 +60,6 @@ caseSplit q = do
6060 let appliedCtors = map (\(n, ts) -> (n, map applyTypeVars ts)) ctors
6161 pure appliedCtors
6262
63−{- ["EDType {
64− edTypeName = ProperName {runProperName = \"Either\"}
65− , edTypeKind = FunKind Star (FunKind Star Star)
66− , edTypeDeclarationKind =
67− DataType [(\"a\",Just Star),(\"b\",Just Star)]
68− [(ProperName {runProperName = \"Left\"},[TypeVar \"a\"])
69− ,(ProperName {runProperName = \"Right\"},[TypeVar \"b\"])]}"]
70−-}
71−
7263findTypeDeclaration :: (PscIde m, MonadLogger m, MonadError PscIdeError m) =>
7364 ProperName 'TypeName -> m ExternsDeclaration
7465findTypeDeclaration q = do
src/Language/PureScript/Ide/Completion.hs+4−4
@@ -24,12 +24,12 @@ getExactMatches search filters modules =
2424
2525completionsFromModules :: [Module] -> [Completion]
2626completionsFromModules = foldMap completionFromModule
27− where
28− completionFromModule :: Module -> [Completion]
29− completionFromModule (moduleIdent, decls) = mapMaybe (completionFromDecl moduleIdent) decls
27+ where
28+ completionFromModule :: Module -> [Completion]
29+ completionFromModule (moduleIdent, decls) = mapMaybe (completionFromDecl moduleIdent) decls
3030
3131completionFromDecl :: ModuleIdent -> ExternDecl -> Maybe Completion
3232completionFromDecl mi (FunctionDecl name type') = Just (Completion (mi, name, type'))
3333completionFromDecl mi (DataDecl name kind) = Just (Completion (mi, name, kind))
34−completionFromDecl _ (ModuleDecl name _) = Just (Completion ("module", name, "module"))
34+completionFromDecl _ (ModuleDecl name _) = Just (Completion ("module", name, "module"))
3535completionFromDecl _ _ = Nothing
src/Language/PureScript/Ide/Error.hs+11−12
@@ -21,21 +21,20 @@ data PscIdeError
2121
2222instance ToJSON PscIdeError where
2323 toJSON err = object
24− [
25− "resultType" .= ("error" :: Text),
26− "result" .= textError err
27− ]
24+ [ "resultType" .= ("error" :: Text)
25+ , "result" .= textError err
26+ ]
2827
2928textError :: PscIdeError -> Text
30−textError (GeneralError msg) = pack msg
31−textError (NotFound ident) = "Symbol '" <> ident <> "' not found."
32−textError (ModuleNotFound ident) = "Module '" <> ident <> "' not found."
33−textError (ModuleFileNotFound ident) = "Extern file for module " <> ident <>" could not be found"
34−textError (ParseError parseError msg) = pack $ msg <> ": " <> show (escape parseError)
35− where
29+textError (GeneralError msg) = pack msg
30+textError (NotFound ident) = "Symbol '" <> ident <> "' not found."
31+textError (ModuleNotFound ident) = "Module '" <> ident <> "' not found."
32+textError (ModuleFileNotFound ident) = "Extern file for module " <> ident <>" could not be found"
33+textError (ParseError parseError msg) = pack $ msg <> ": " <> show (escape parseError)
34+ where
3635 -- escape newlines and other special chars so we can send the error over the socket as a single line
37− escape :: P.ParseError -> String
38− escape = show
36+ escape :: P.ParseError -> String
37+ escape = show
3938
4039-- | Specialized version of `first` from `Data.Bifunctors`
4140first :: (a -> b) -> Either a r -> Either b r
src/Language/PureScript/Ide/Matcher.hs+6−6
@@ -76,8 +76,8 @@ flexMatch pattern = mapMaybe (flexRate pattern)
7676
7777flexRate :: Text -> Completion -> Maybe ScoredCompletion
7878flexRate pattern c@(Completion (_,ident,_)) = do
79− score <- flexScore pattern ident
80− return (c, score)
79+ score <- flexScore pattern ident
80+ return (c, score)
8181
8282-- FlexMatching ala Sublime.
8383-- Borrowed from: http://cdewaka.com/2013/06/fuzzy-pattern-matching-in-haskell/
@@ -88,13 +88,13 @@ flexRate pattern c@(Completion (_,ident,_)) = do
8888flexScore :: Text -> DeclIdent -> Maybe Double
8989flexScore "" _ = Nothing
9090flexScore pat str =
91− case TE.encodeUtf8 str =~ TE.encodeUtf8 pat' :: (Int, Int) of
92− (-1,0) -> Nothing
93− (start,len) -> Just $ calcScore start (start + len)
91+ case TE.encodeUtf8 str =~ TE.encodeUtf8 pat' :: (Int, Int) of
92+ (-1,0) -> Nothing
93+ (start,len) -> Just $ calcScore start (start + len)
9494 where
9595 Just (first,pattern) = T.uncons pat
9696 -- This just interleaves the search string with .*
9797 -- abcd -> a.*b.*c.*d
9898 pat' = first `T.cons` T.concatMap (T.snoc ".*") pattern
9999 calcScore start end =
100− 100.0 / fromIntegral ((1 + start) * (end - start + 1))
100+ 100.0 / fromIntegral ((1 + start) * (end - start + 1))
src/Language/PureScript/Ide/Pursuit.hs+11−11
@@ -10,9 +10,9 @@ import qualified Control.Exception as E
1010import Data.Aeson
1111import Data.ByteString (ByteString)
1212import Data.ByteString.Lazy (fromStrict)
13−import Data.Foldable (toList)
13+import Data.Foldable (toList)
14+import Data.Maybe (mapMaybe)
1415import Data.Monoid ((<>))
15−import Data.Maybe (mapMaybe)
1616import Data.String
1717import Data.Text (Text)
1818import qualified Data.Text as T
@@ -33,12 +33,12 @@ queryPursuit q = do
3333 }
3434 m <- newManager tlsManagerSettings
3535 withHTTP req m $ \resp ->
36− P.fold (\x a -> x <> a) "" id $ responseBody resp
36+ P.fold (<>) "" id $ responseBody resp
3737
3838
3939handler :: HttpException -> IO [a]
40−handler StatusCodeException{} = return []
41−handler _ = return []
40+handler StatusCodeException{} = pure []
41+handler _ = pure []
4242
4343searchPursuitForDeclarations :: Text -> IO [PursuitResponse]
4444searchPursuitForDeclarations query =
@@ -54,12 +54,12 @@ searchPursuitForDeclarations query =
5454
5555findPackagesForModuleIdent :: Text -> IO [PursuitResponse]
5656findPackagesForModuleIdent query =
57− (do r <- queryPursuit query
58− let results' = decode (fromStrict r) :: Maybe Array
59− case results' of
60− Nothing -> pure []
61− Just results -> pure (mapMaybe isModuleResponse (map fromJSON (toList results)))) `E.catch`
62− handler
57+ (do r <- queryPursuit query
58+ let results' = decode (fromStrict r) :: Maybe Array
59+ case results' of
60+ Nothing -> pure []
61+ Just results -> pure (mapMaybe isModuleResponse (map fromJSON (toList results)))) `E.catch`
62+ handler
6363 where
6464 isModuleResponse (Success a@ModuleResponse{}) = Just a
6565 isModuleResponse _ = Nothing
src/Language/PureScript/Ide/Reexports.hs+21−19
@@ -15,10 +15,10 @@ import Language.PureScript.Ide.Types
1515
1616getReexports :: Module -> [ExternDecl]
1717getReexports (mn, decls)= concatMap getExport decls
18− where getExport d
19− | (Export mn') <- d
20− , mn /= mn' = replaceExportWithAliases decls mn'
21− | otherwise = []
18+ where getExport d
19+ | (Export mn') <- d
20+ , mn /= mn' = replaceExportWithAliases decls mn'
21+ | otherwise = []
2222
2323dependencyToExport :: ExternDecl -> ExternDecl
2424dependencyToExport (Dependency m _ _) = Export m
@@ -51,23 +51,25 @@ removeExportDecls = fmap (filter (not . isExport))
5151
5252replaceReexports :: Module -> Map ModuleIdent [ExternDecl] -> Module
5353replaceReexports m db = result
54− where reexports = getReexports m
55− result = foldl go (removeExportDecls m) reexports
54+ where
55+ reexports = getReexports m
56+ result = foldl go (removeExportDecls m) reexports
5657
57− go :: Module -> ExternDecl -> Module
58− go m' re@(Export name) = replaceReexport re m' (getModule name)
59− go _ _ = error "partiality! woohoo"
58+ go :: Module -> ExternDecl -> Module
59+ go m' re@(Export name) = replaceReexport re m' (getModule name)
60+ go _ _ = error "partiality! woohoo"
6061
61− getModule :: ModuleIdent -> Module
62− getModule name = clean res
63− where res = fromMaybe emptyModule $ (name , ) <$> Map.lookup name db
64− -- we have to do this because keeping self exports in will result in
65− -- infinite loops
66− clean (mn, decls) = (mn,) (filter (/= Export mn) decls)
62+ getModule :: ModuleIdent -> Module
63+ getModule name = clean res
64+ where
65+ res = fromMaybe emptyModule $ (name , ) <$> Map.lookup name db
66+ -- we have to do this because keeping self exports in will result in
67+ -- infinite loops
68+ clean (mn, decls) = (mn,) (filter (/= Export mn) decls)
6769
6870resolveReexports :: Map ModuleIdent [ExternDecl] -> Module -> Module
69−resolveReexports modules m = do
71+resolveReexports modules m =
7072 let replaced = replaceReexports m modules
71− if null . getReexports $ replaced
72− then replaced
73− else resolveReexports modules replaced
73+ in if null (getReexports replaced)
74+ then replaced
75+ else resolveReexports modules replaced
src/Language/PureScript/Ide/SourceFile.hs+37−36
@@ -52,18 +52,19 @@ getImportsForFile fp = do
5252 module' <- parseModuleFromFile fp
5353 let imports = getImports module'
5454 pure (mkModuleImport . unwrapPositionedImport <$> imports)
55− where mkModuleImport (D.ImportDeclaration mn importType' qualifier _) =
56− ModuleImport
57− (T.pack (N.runModuleName mn))
58− importType'
59− (T.pack . N.runModuleName <$> qualifier)
60− mkModuleImport _ = error "Shouldn't have gotten anything but Imports here"
61− unwrapPositionedImport (D.ImportDeclaration mn importType' qualifier b) =
62− D.ImportDeclaration mn (unwrapImportType importType') qualifier b
63− unwrapPositionedImport x = x
64− unwrapImportType (D.Explicit decls) = D.Explicit (map unwrapPositionedRef decls)
65− unwrapImportType (D.Hiding decls) = D.Hiding (map unwrapPositionedRef decls)
66− unwrapImportType D.Implicit = D.Implicit
55+ where
56+ mkModuleImport (D.ImportDeclaration mn importType' qualifier _) =
57+ ModuleImport
58+ (T.pack (N.runModuleName mn))
59+ importType'
60+ (T.pack . N.runModuleName <$> qualifier)
61+ mkModuleImport _ = error "Shouldn't have gotten anything but Imports here"
62+ unwrapPositionedImport (D.ImportDeclaration mn importType' qualifier b) =
63+ D.ImportDeclaration mn (unwrapImportType importType') qualifier b
64+ unwrapPositionedImport x = x
65+ unwrapImportType (D.Explicit decls) = D.Explicit (map unwrapPositionedRef decls)
66+ unwrapImportType (D.Hiding decls) = D.Hiding (map unwrapPositionedRef decls)
67+ unwrapImportType D.Implicit = D.Implicit
6768
6869getPositionedImports :: D.Module -> [D.Declaration]
6970getPositionedImports (D.Module _ _ _ declarations _) =
@@ -73,34 +74,34 @@ getPositionedImports (D.Module _ _ _ declarations _) =
7374 isImport _ = Nothing
7475
7576getDeclPosition :: D.Module -> String -> Maybe SP.SourceSpan
76−getDeclPosition m ident =
77− let decls = getDeclarations m
78− in getFirst (foldMap (match ident) decls)
79− where match q (D.PositionedDeclaration ss _ decl) = First (if go q decl
80− then Just ss
81− else Nothing)
82− match _ _ = First Nothing
77+getDeclPosition m ident = getFirst (foldMap (match ident) decls)
78+ where
79+ decls = getDeclarations m
80+ match q (D.PositionedDeclaration ss _ decl) = First (if go q decl
81+ then Just ss
82+ else Nothing)
83+ match _ _ = First Nothing
8384
84− go q (D.DataDeclaration _ name _ constructors) =
85− properEqual name q || any (\(x,_) -> properEqual x q) constructors
86− go q (D.DataBindingGroupDeclaration decls) = any (go q) decls
87− go q (D.TypeSynonymDeclaration name _ _) = properEqual name q
88− go q (D.TypeDeclaration ident' _) = identEqual ident' q
89− go q (D.ValueDeclaration ident' _ _ _) = identEqual ident' q
90− go q (D.ExternDeclaration ident' _) = identEqual ident' q
91− go q (D.ExternDataDeclaration name _) = properEqual name q
92− go q (D.TypeClassDeclaration name _ _ members) =
93− properEqual name q || any (go q . unwrapPositioned) members
94− go q (D.TypeInstanceDeclaration ident' _ _ _ _) =
95− identEqual ident' q
96− go _ _ = False
85+ go q (D.DataDeclaration _ name _ constructors) =
86+ properEqual name q || any (\(x,_) -> properEqual x q) constructors
87+ go q (D.DataBindingGroupDeclaration decls') = any (go q) decls'
88+ go q (D.TypeSynonymDeclaration name _ _) = properEqual name q
89+ go q (D.TypeDeclaration ident' _) = identEqual ident' q
90+ go q (D.ValueDeclaration ident' _ _ _) = identEqual ident' q
91+ go q (D.ExternDeclaration ident' _) = identEqual ident' q
92+ go q (D.ExternDataDeclaration name _) = properEqual name q
93+ go q (D.TypeClassDeclaration name _ _ members) =
94+ properEqual name q || any (go q . unwrapPositioned) members
95+ go q (D.TypeInstanceDeclaration ident' _ _ _ _) =
96+ identEqual ident' q
97+ go _ _ = False
9798
98− properEqual x q = N.runProperName x == q
99− identEqual x q = N.runIdent x == q
99+ properEqual x q = N.runProperName x == q
100+ identEqual x q = N.runIdent x == q
100101
101102goToDefinition :: String -> FilePath -> IO (Maybe SP.SourceSpan)
102103goToDefinition q fp = do
103104 m <- runExceptT (parseModuleFromFile fp)
104105 case m of
105− Right module' -> return $ getDeclPosition module' q
106− Left _ -> return Nothing
106+ Right module' -> pure (getDeclPosition module' q)
107+ Left _ -> pure Nothing
src/Language/PureScript/Ide/State.hs+3−3
@@ -73,8 +73,8 @@ insertModule externsFile = do
7373
7474insertModule' :: TVar PscIdeState -> ExternsFile -> STM ()
7575insertModule' st ef = do
76− modifyTVar (st) $ \x ->
76+ modifyTVar st $ \x ->
7777 x { externsFiles = M.insert (efModuleName ef) ef (externsFiles x)
78− , pscStateModules = let (mn, decls ) = convertExterns ef
79− in M.insert mn decls (pscStateModules x)
78+ , pscStateModules = let (mn, decls) = convertExterns ef
79+ in M.insert mn decls (pscStateModules x)
8080 }
src/Language/PureScript/Ide/Types.hs+75−77
@@ -33,21 +33,26 @@ type Type = Text
3333data Fixity = Infix | Infixl | Infixr deriving(Show, Eq, Ord)
3434
3535data ExternDecl
36− = FunctionDecl { functionName :: DeclIdent
37− , functionType :: Type
38− }
39− | FixityDeclaration Fixity
40− Int
41− DeclIdent
42− | Dependency { dependencyModule :: ModuleIdent
43− , dependencyNames :: [Text]
44− , dependencyAlias :: Maybe Text
45− }
46− | ModuleDecl ModuleIdent
47− [DeclIdent]
48− | DataDecl DeclIdent
49− Text
50− | Export ModuleIdent
36+ -- | A function/value declaration
37+ = FunctionDecl
38+ DeclIdent -- The functions name
39+ Type -- The functions type
40+ | FixityDeclaration Fixity Int DeclIdent
41+ -- | A Dependency onto another Module
42+ | Dependency
43+ ModuleIdent -- name of the dependency
44+ [Text] -- explicit imports
45+ (Maybe Text) -- An eventual qualifier
46+
47+ -- | A module declaration
48+ | ModuleDecl
49+ ModuleIdent -- The modules name
50+ [DeclIdent] -- The exported identifiers
51+ -- | A data/newtype declaration
52+ | DataDecl DeclIdent -- The type name
53+ Text -- The "type"
54+ -- | An exported module
55+ | Export ModuleIdent -- The exported Modules name
5156 deriving (Show,Eq,Ord)
5257
5358instance ToJSON ExternDecl where
@@ -63,22 +68,22 @@ instance ToJSON ExternDecl where
6368type Module = (ModuleIdent, [ExternDecl])
6469
6570data Configuration =
66− Configuration {
67− confOutputPath :: FilePath
71+ Configuration
72+ { confOutputPath :: FilePath
6873 , confDebug :: Bool
6974 }
7075
7176data PscIdeEnvironment =
72− PscIdeEnvironment {
73− envStateVar :: TVar PscIdeState
77+ PscIdeEnvironment
78+ { envStateVar :: TVar PscIdeState
7479 , envConfiguration :: Configuration
7580 }
7681
7782type PscIde m = (Applicative m, MonadIO m, MonadReader PscIdeEnvironment m)
7883
7984data PscIdeState =
80− PscIdeState {
81− pscStateModules :: M.Map Text [ExternDecl]
85+ PscIdeState
86+ { pscStateModules :: M.Map Text [ExternDecl]
8287 , externsFiles :: M.Map ModuleName ExternsFile
8388 } deriving Show
8489
@@ -90,29 +95,32 @@ newtype Completion =
9095 deriving (Show,Eq)
9196
9297data ModuleImport =
93− ModuleImport {
94− importModuleName :: ModuleIdent
98+ ModuleImport
99+ { importModuleName :: ModuleIdent
95100 , importType :: D.ImportDeclarationType
96101 , importQualifier :: Maybe Text
97102 } deriving(Show)
98103
99104instance Eq ModuleImport where
100− mi1 == mi2 = importModuleName mi1 == importModuleName mi2
101− && importQualifier mi1 == importQualifier mi2
105+ mi1 == mi2 =
106+ importModuleName mi1 == importModuleName mi2
107+ && importQualifier mi1 == importQualifier mi2
102108
103109instance ToJSON ModuleImport where
104110 toJSON (ModuleImport mn D.Implicit qualifier) =
105− object $ ["module" .= mn
106− , "importType" .= ("implicit" :: Text)
107− ] ++ fmap (\x -> "qualifier" .= x) (maybeToList qualifier)
111+ object $ [ "module" .= mn
112+ , "importType" .= ("implicit" :: Text)
113+ ] ++ fmap (\x -> "qualifier" .= x) (maybeToList qualifier)
108114 toJSON (ModuleImport mn (D.Explicit refs) _) =
109− object ["module" .= mn
115+ object [ "module" .= mn
110116 , "importType" .= ("explicit" :: Text)
111− , "identifiers" .= (identifierFromDeclarationRef <$> refs)]
117+ , "identifiers" .= (identifierFromDeclarationRef <$> refs)
118+ ]
112119 toJSON (ModuleImport mn (D.Hiding refs) _) =
113− object ["module" .= mn
120+ object [ "module" .= mn
114121 , "importType" .= ("hiding" :: Text)
115− , "identifiers" .= (identifierFromDeclarationRef <$> refs)]
122+ , "identifiers" .= (identifierFromDeclarationRef <$> refs)
123+ ]
116124
117125identifierFromDeclarationRef :: D.DeclarationRef -> String
118126identifierFromDeclarationRef (D.TypeRef name _) = N.runProperName name
@@ -121,16 +129,16 @@ identifierFromDeclarationRef (D.TypeClassRef name) = N.runProperName name
121129identifierFromDeclarationRef _ = ""
122130
123131instance FromJSON Completion where
124− parseJSON (Object o) = do
125− m <- o .: "module"
126− d <- o .: "identifier"
127− t <- o .: "type"
128− return $ Completion (m, d, t)
129− parseJSON _ = mzero
132+ parseJSON (Object o) = do
133+ m <- o .: "module"
134+ d <- o .: "identifier"
135+ t <- o .: "type"
136+ pure (Completion (m, d, t))
137+ parseJSON _ = mzero
130138
131139instance ToJSON Completion where
132− toJSON (Completion (m,d,t)) =
133− object ["module" .= m, "identifier" .= d, "type" .= t]
140+ toJSON (Completion (m,d,t)) =
141+ object ["module" .= m, "identifier" .= d, "type" .= t]
134142
135143data Success =
136144 CompletionResult [Completion]
@@ -161,23 +169,22 @@ data PursuitSearchType = Package | Identifier
161169
162170instance FromJSON PursuitSearchType where
163171 parseJSON (String t) = case t of
164− "package" -> return Package
165− "completion" -> return Identifier
172+ "package" -> pure Package
173+ "completion" -> pure Identifier
166174 _ -> mzero
167175 parseJSON _ = mzero
168176
169177instance FromJSON PursuitQuery where
170− parseJSON o = fmap PursuitQuery (parseJSON o)
171−
172−data PursuitResponse
173− = ModuleResponse { moduleResponseName :: Text
174− , moduleResponsePackage :: Text}
175− | DeclarationResponse { declarationResponseType :: Text
176− , declarationResponseModule :: Text
177− , declarationResponseIdent :: Text
178− , declarationResponsePackage :: Text
179− }
180− deriving (Show,Eq)
178+ parseJSON o = PursuitQuery <$> (parseJSON o)
179+
180+data PursuitResponse =
181+ -- | A Pursuit Response for a module. Consists of the modules name and the
182+ -- package it belongs to
183+ ModuleResponse ModuleIdent Text
184+ -- | A Pursuit Response for a declaration. Consist of the declarations type,
185+ -- module, name and package
186+ | DeclarationResponse Type ModuleIdent DeclIdent Text
187+ deriving (Show,Eq)
181188
182189instance FromJSON PursuitResponse where
183190 parseJSON (Object o) = do
@@ -186,22 +193,12 @@ instance FromJSON PursuitResponse where
186193 (type' :: String) <- info .: "type"
187194 case type' of
188195 "module" -> do
189− name <- info .: "module"
190− return
191− ModuleResponse
192− { moduleResponseName = name
193− , moduleResponsePackage = package
194− }
196+ name <- info .: "module"
197+ pure (ModuleResponse name package)
195198 "declaration" -> do
196− moduleName <- info .: "module"
197− Right (ident, declType) <- typeParse <$> o .: "text"
198− return
199− DeclarationResponse
200− { declarationResponseType = declType
201− , declarationResponseModule = moduleName
202− , declarationResponseIdent = ident
203− , declarationResponsePackage = package
204− }
199+ moduleName <- info .: "module"
200+ Right (ident, declType) <- typeParse <$> o .: "text"
201+ pure (DeclarationResponse declType moduleName ident package)
205202 _ -> mzero
206203 parseJSON _ = mzero
207204
@@ -217,7 +214,7 @@ typeParse t = case parse parseType "" t of
217214 _ <- string "::"
218215 spaces
219216 type' <- many1 anyChar
220− return (unpack name, type')
217+ pure (unpack name, type')
221218
222219identifier :: Parser Text
223220identifier = do
@@ -227,14 +224,15 @@ identifier = do
227224 between (char '(') (char ')') (many1 (noneOf ", )")) <|>
228225 many1 (noneOf ", )")
229226 spaces
230− return (pack ident)
227+ pure (pack ident)
231228
232229instance ToJSON PursuitResponse where
233− toJSON ModuleResponse{..} =
234− object ["module" .= moduleResponseName, "package" .= moduleResponsePackage]
235− toJSON DeclarationResponse{..} =
230+ toJSON (ModuleResponse name package) =
231+ object ["module" .= name, "package" .= package]
232+ toJSON (DeclarationResponse module' ident type' package) =
236233 object
237− [ "module" .= declarationResponseModule
238− , "ident" .= declarationResponseIdent
239− , "type" .= declarationResponseType
240− , "package" .= declarationResponsePackage]
234+ [ "module" .= module'
235+ , "ident" .= ident
236+ , "type" .= type'
237+ , "package" .= package
238+ ]