fixed: GToSchema: infinite call: single constructor and recur#37
Merged
Conversation
why === I want to use GHC of supported [haskell/haskell-language-server: Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.](https://github.com/haskell/haskell-language-server).
I want timeout for test like below,
~~~hs
-- | create schema of self and ref another.
-- timeout in 1 seconds.
-- because avoid infinite call.
checkToSchemaDeclare :: (HasCallStack, ToSchema a) => Proxy a -> Value -> Spec
checkToSchemaDeclare proxy js = do
mActuial <- runIO $ timeout (secondsToMicroseconds 1) $ evaluate $ force $ runDeclare (declareSchemaRef proxy) mempty
case mActuial of
Nothing -> it "test is timeout" $ mActuial `shouldNotBe` Nothing
Just actuial -> actuial <=> js
secondsToMicroseconds :: Int -> Int
secondsToMicroseconds seconds = seconds * 10 ^ (6 :: Int)
~~~
However `Schema` is not `NFData`.
So I gave up.
I followed `declareSchemaRef` to make sure that the context of `InsOrdHashMap` disappears. Since the cause seems to be here, I rewrote it to keep the context and continue the calculation.
Contributor
Author
|
I would like to see this MERGE because it fixes a bug that will be important there in using this library. |
Collaborator
|
Sorry @ncaq! Looks like I had wrong notifications configuration for this repo and did not notice this PR until you pinged me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We combined Servant with OpenApi3 and found that the calculation does not finish if there is a cycled single field data type.
Since we were creating data types like the one described in our test data, and it was very annoying that we couldn't create OpenApi data, we investigated the cause and fixed it.
It seems that the test does not pass in the new version of GHC, and the same is true for the existing master, so we left it alone.
Thanks for the great library.
It would be great if you could incorporate it and release it.