Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow some ghci interaction (:doc, :type, :info) #11

Open
jwaldmann opened this issue May 11, 2020 · 0 comments
Open

allow some ghci interaction (:doc, :type, :info) #11

jwaldmann opened this issue May 11, 2020 · 0 comments

Comments

@jwaldmann
Copy link
Owner

jwaldmann commented May 11, 2020

see haskell-hint/hint#101

I will print the type anyway, so we don't need :type

           I.typeChecksWithDetails contents >>= \ case
             Left errs -> throw $ I.WontCompile errs
             Right s ->
               if s == "Op ()" then do -- execute, print nothing
                 -- TODO: need timeout for evaluation of pattern:
                 x <- I.interpret contents (I.as :: C.Op ())
                 -- have timeout for execution of pattern:
                 liftIO $ void $ timeout (1 * second) $ C.exec tidal x
               else do -- print type and value
                 message stdout $ "type : " <> s
                 if isPrefixOf "IO" s then do
                   message stderr "cannot show value, will not execute action"
                 else do
                   v <- I.eval contents
                   message stdout $ "value: " <> v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant