haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.39k stars 211 forks source link

No output on a GHC 8.6 project #969

Closed LukaHorvat closed 5 years ago

LukaHorvat commented 5 years ago

I just built the latest master. Running hie in the project directory correctly runs the GHC 8.6 version which matches my project. However, using the Atom integration (or VS code for that matter), doesn't work. Neither autocompletion, or errors, or types on hover. This is the debug log output

2018-12-02 23:32:37.6427055 [ThreadId 3] - Using stack GHC version
2018-12-02 23:32:37.8428069 [ThreadId 3] - Run entered for HIE(hie) Version 0.4.0.1, Git revision 7e0b19721872d1c8e44f49484ac75f6c61412349 (dirty) (2220 commits) x86_64 ghc-8.6.2
2018-12-02 23:32:37.8428069 [ThreadId 3] - Current directory:C:\Users\darwi\Projects\simple-effects
2018-12-02 23:32:37.8428069 [ThreadId 3] - 

haskell-lsp:Starting up server ...
2018-12-02 23:32:37.8438045 [ThreadId 3] - ---> {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":18200,"rootPath":"C:\\Users\\darwi\\Projects\\simple-effects\\","rootUri":"file:///C:/Users/darwi/Projects/simple-effects/","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true},"didChangeConfiguration":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":false},"symbol":{"dynamicRegistration":false},"executeCommand":{"dynamicRegistration":false}},"textDocument":{"synchronization":{"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":false,"didSave":true},"completion":{"dynamicRegistration":false,"completionItem":{"snippetSupport":true,"commitCharactersSupport":false},"contextSupport":true},"hover":{"dynamicRegistration":false},"signatureHelp":{"dynamicRegistration":false},"references":{"dynamicRegistration":false},"documentHighlight":{"dynamicRegistration":false},"documentSymbol":{"dynamicRegistration":false},"formatting":{"dynamicRegistration":false},"rangeFormatting":{"dynamicRegistration":false},"onTypeFormatting":{"dynamicRegistration":false},"definition":{"dynamicRegistration":false},"codeAction":{"dynamicRegistration":false},"codeLens":{"dynamicRegistration":false},"documentLink":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false}},"experimental":{}}}}
2018-12-02 23:32:37.8487992 [ThreadId 3] - haskell-lsp:initializeRequestHandler: setting current dir to project root:C:\Users\darwi\Projects\simple-effects
2018-12-02 23:32:37.8946681 [ThreadId 14] - ideDispatcher: top of loop
2018-12-02 23:32:37.8996556 [ThreadId 5] - <--2--{"result":{"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"willSave":false,"willSaveWaitUntil":false,"save":{"includeText":false}},"workspace":{},"documentRangeFormattingProvider":true,"documentHighlightProvider":true,"executeCommandProvider":{"commands":["18200:applyrefact:applyOne","18200:applyrefact:applyAll","18200:applyrefact:lint","18200:base:version","18200:base:plugins","18200:base:commands","18200:base:commandDetail","18200:brittany:format","18200:build:prepare","18200:build:isConfigured","18200:build:configure","18200:build:listTargets","18200:build:listFlags","18200:build:buildDirectory","18200:build:buildTarget","18200:ghcmod:check","18200:ghcmod:lint","18200:ghcmod:info","18200:ghcmod:type","18200:ghcmod:casesplit","18200:hare:demote","18200:hare:dupdef","18200:hare:iftocase","18200:hare:liftonelevel","18200:hare:lifttotoplevel","18200:hare:rename","18200:hare:deletedef","18200:hare:genapplicative","18200:hare:casesplit","18200:hoogle:info","18200:hoogle:lookup","18200:hsimport:import","18200:liquid:sayHello","18200:liquid:sayHelloTo","18200:package:add","18200:pragmas:addPragma"]},"renameProvider":true,"definitionProvider":true,"hoverProvider":true,"codeActionProvider":true,"completionProvider":{"triggerCharacters":["."],"resolveProvider":true},"documentSymbolProvider":true,"documentFormattingProvider":true,"referencesProvider":true}},"jsonrpc":"2.0","id":0}
2018-12-02 23:32:37.9056411 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"initialized","params":{}}
2018-12-02 23:32:37.9056411 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects.hs","languageId":"haskell","version":1,"text":"{-# LANGUAGE TypeFamilies, RankNTypes #-}\r\n{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, GeneralizedNewtypeDeriving #-}\r\n{-# LANGUAGE FlexibleContexts, ScopedTypeVariables, InstanceSigs, UndecidableInstances #-}\r\n{-# LANGUAGE DefaultSignatures #-}\r\n{-# LANGUAGE StandaloneDeriving, DataKinds #-}\r\n{-# LANGUAGE TypeOperators #-}\r\n{-# LANGUAGE UndecidableSuperClasses, FunctionalDependencies, PolyKinds #-}\r\nmodule Control.Effects (module Control.Effects) where\r\n\r\nimport Import hiding (liftThrough)\r\nimport Control.Monad.Runnable\r\nimport Control.Effects.Generic\r\nimport GHC.Generics\r\nimport Control.Monad.Fail (MonadFail)\r\n\r\nclass Effect (e :: (* -> *) -> *) where\r\n    type CanLift e (t :: (* -> *) -> * -> *) :: Constraint\r\n    type CanLift e t = MonadTrans t\r\n\r\n    type ExtraConstraint e (m :: * -> *) :: Constraint\r\n    type ExtraConstraint e m = ()\r\n\r\n    liftThrough ::\r\n        forall t m. (CanLift e t, Monad m, Monad (t m))\r\n        => e m -> e (t m)\r\n    default liftThrough ::\r\n        forall t m.\r\n        ( Generic (e m), MonadTrans t, Monad m, Monad (t m)\r\n        , SimpleMethods e m t )\r\n        => e m -> e (t m)\r\n    liftThrough = genericLiftThrough\r\n\r\n    mergeContext :: Monad m => m (e m) -> e m\r\n    default mergeContext ::\r\n        (Generic (e m), MonadicMethods e m)\r\n        => m (e m) -> e m\r\n    mergeContext = genericMergeContext\r\n\r\nclass (Effect e, Monad m, ExtraConstraint e m) => MonadEffect e m where\r\n    effect :: e m\r\n    default effect :: (MonadEffect e m', Monad (t m'), CanLift e t, t m' ~ m) => e m\r\n    effect = liftThrough effect\r\n\r\ninstance {-# OVERLAPPABLE #-}\r\n    (MonadEffect e m, Monad (t m), CanLift e t, ExtraConstraint e (t m))\r\n    => MonadEffect e (t m) where\r\n    effect = liftThrough effect\r\n\r\nnewtype RuntimeImplemented e m a = RuntimeImplemented\r\n    { getRuntimeImplemented :: ReaderT (e m) m a }\r\n    deriving\r\n        ( Functor, Applicative, Monad, MonadPlus, Alternative, MonadState s, MonadIO, MonadCatch\r\n        , MonadThrow, MonadRandom, MonadMask, MonadFail )\r\n\r\ninstance MonadTrans (RuntimeImplemented e) where\r\n    lift = RuntimeImplemented . lift\r\n\r\ninstance MonadReader r m => MonadReader r (RuntimeImplemented e m) where\r\n    ask = RuntimeImplemented (lift ask)\r\n    local f (RuntimeImplemented rdr) = RuntimeImplemented (ReaderT (local f . runReaderT rdr))\r\n\r\nderiving instance MonadBase b m => MonadBase b (RuntimeImplemented e m)\r\ninstance MonadBaseControl b m => MonadBaseControl b (RuntimeImplemented e m) where\r\n    type StM (RuntimeImplemented e m) a = StM (ReaderT (e m) m) a\r\n    liftBaseWith f = RuntimeImplemented $ liftBaseWith $ \\q -> f (q . getRuntimeImplemented)\r\n    restoreM = RuntimeImplemented . restoreM\r\n\r\ninstance RunnableTrans (RuntimeImplemented e) where\r\n    type TransformerResult (RuntimeImplemented e) a = a\r\n    type TransformerState (RuntimeImplemented e) m = e m\r\n    currentTransState = RuntimeImplemented ask\r\n    restoreTransState = return\r\n    runTransformer (RuntimeImplemented m) = runReaderT m\r\n\r\ninstance (Effect e, Monad m, CanLift e (RuntimeImplemented e), ExtraConstraint e (RuntimeImplemented e m))\r\n    => MonadEffect e (RuntimeImplemented e m) where\r\n    effect = mergeContext $ RuntimeImplemented (liftThrough <$> ask)\r\n\r\nimplement :: forall e m a. e m -> RuntimeImplemented e m a -> m a\r\nimplement em (RuntimeImplemented r) = runReaderT r em\r\n\r\ntype family MonadEffects effs m :: Constraint where\r\n    MonadEffects '[] m = ()\r\n    MonadEffects (eff ': effs) m = (MonadEffect eff m, MonadEffects effs m)\r\n\r\nclass UniqueEffect (effName :: k) (m :: * -> *) a | effName m -> a\r\ninstance {-# OVERLAPPABLE #-} UniqueEffect effName m a => UniqueEffect effName (t m) a\r\n"}}}
2018-12-02 23:32:37.90664 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","languageId":"haskell","version":1,"text":"{-# LANGUAGE TypeApplications, ScopedTypeVariables, AllowAmbiguousTypes #-}\r\n{-# LANGUAGE FlexibleContexts, KindSignatures, PolyKinds #-}\r\n{-# LANGUAGE TypeFamilies, FlexibleInstances, MultiParamTypeClasses #-}\r\n{-# LANGUAGE UndecidableInstances, DataKinds, NoMonomorphismRestriction #-}\r\n{-# LANGUAGE RankNTypes, TypeOperators, DerivingStrategies, GeneralizedNewtypeDeriving #-}\r\n-- | Sometimes it's useful to give a new name to an already existing effect. This module provides\r\n--   the tools to make that easy to do.\r\nmodule Control.Effects.Newtype where\r\n\r\nimport Import (ask)\r\nimport Control.Effects\r\nimport Data.Coerce\r\nimport Control.Effects.State\r\nimport Unsafe.Coerce\r\nimport Data.Constraint\r\nimport Control.Monad.Reader\r\n\r\n-- | If we have a computation using some effect @original@, we can convert it into a computation\r\n--   that uses the effect @newtyped@ instead. Provided, of course, that @newtyped@ is really a\r\n--   newtype over the @original@ effect.\r\n--\r\n-- @\r\n-- f :: 'MonadEffect' ('State' Int) m => m ()\r\n-- f = getState >>= \\i -> setState (i + 1)\r\n--\r\n-- newtype MyState m = MyState ('State' Int m)\r\n--\r\n-- -- inferred: g :: 'MonadEffect' MyState m => m ()\r\n-- g = 'effectAsNewtype' \\@MyState \\@('State' Int) f\r\n-- @\r\neffectAsNewtype :: forall newtyped original m a.\r\n    (MonadEffect newtyped m, Coercible (newtyped m) (original m))\r\n    => RuntimeImplemented original m a -> m a\r\neffectAsNewtype = implement (coerce (effect @newtyped :: newtyped m))\r\n\r\n-- | A useful newtype for any effect. Just provide a unique tag, like a type level string.\r\nnewtype EffTag (tag :: k) e (m :: * -> *) = EffTag (e m)\r\ninstance Effect e => Effect (EffTag tag e) where\r\n    type CanLift (EffTag tag e) t = CanLift e t\r\n    liftThrough (EffTag e) = EffTag (liftThrough e)\r\n    mergeContext m = EffTag (mergeContext (fmap coerce m))\r\n\r\ninstance {-# INCOHERENT #-}\r\n    ( e ~ e', Effect e, Monad m\r\n    , CanLift e (RuntimeImplemented (EffTag tag e)) )\r\n    => MonadEffect (EffTag tag e) (RuntimeImplemented (EffTag tag e') m) where\r\n    effect = mergeContext $ RuntimeImplemented (liftThrough <$> ask)\r\n\r\n-- | Rename an effect without explicitly declaring a new newtype. Just provide a tag.\r\n--   This is useful if you have two functions using the same effect that you want to combine but\r\n--   you don't want their effects to interact. For example, maybe they both work with @Int@ states\r\n--   but you don't want them to modify each other's number.\r\ntagEffect :: forall tag original m a.\r\n    MonadEffect (EffTag tag original) m\r\n    => RuntimeImplemented original m a -> m a\r\ntagEffect = effectAsNewtype @(EffTag tag original)\r\n\r\n-- | Once you tag your effect, it's /slightly/ inconvenient that you have to wrap your implementation\r\n--   when you want to handle it. This function doees the wrapping for you.\r\n--\r\n-- @\r\n-- f :: 'MonadEffect' ('State' Int) m => m ()\r\n-- f = 'getState' >>= \\\\s -> 'setState' (s * 2)\r\n--\r\n-- g :: 'MonadEffect' ('State' Int) m => m ()\r\n-- g = 'getState' >>= \\\\s -> 'setState' (s * 3)\r\n--\r\n-- combine :: Monad m => m Int\r\n-- combine =\r\n--     'implementStateViaStateT' 5 $ 'implementTagged' \\@\"s2\" ('StateMethods' 'getState' 'setState')\r\n--     $ 'implementStateViaStateT' 0 $ 'implementTagged' \\@\"s1\" ('StateMethods' 'getState' 'setState')\r\n--     $ do\r\n--     r1 \\<- 'tagEffect' \\@\"s1\" \\@('State' Int) (f >> 'getState')\r\n--     r2 \\<- 'tagEffect' \\@\"s2\" \\@('State' Int) (g >> 'getState')\r\n--     return (r1 + r2) -- results in 15\r\n-- @\r\nimplementTagged :: forall tag original m a.\r\n    original m -> RuntimeImplemented (EffTag tag original) m a -> m a\r\nimplementTagged = implement . coerce\r\n\r\nnewtypeEffEntails ::\r\n    Coercible (newtyped m) (original m)\r\n    => MonadEffect newtyped m :- MonadEffect original m\r\nnewtypeEffEntails = unmapDict unsafeCoerce\r\n\r\nnewtypeEffect ::\r\n    forall newtyped original m a.\r\n    (MonadEffect newtyped m, Coercible (newtyped m) (original m))\r\n    => (original m -> newtyped m) -> (MonadEffect original m => m a) -> m a\r\nnewtypeEffect _ c = c \\\\ newtypeEffEntails @newtyped @m @original\r\n\r\ntagEffect' ::\r\n    forall tag original m a.\r\n    (MonadEffect (EffTag tag original) m)\r\n    => (MonadEffect original m => m a) -> m a\r\ntagEffect' = newtypeEffect (EffTag @tag @original)\r\n\r\ntagAndImplement :: forall tag original m a.\r\n    (Effect original, CanLift original (RuntimeImplemented (EffTag tag original)), Monad m)\r\n    => original m\r\n    -> (MonadEffect original (RuntimeImplemented (EffTag tag original) m)\r\n        => RuntimeImplemented (EffTag tag original) m a)\r\n    -> m a\r\ntagAndImplement imp m = implementTagged @tag imp (tagEffect' @tag m)\r\n\r\nuntag :: forall tag original m a.\r\n    RuntimeImplemented (EffTag tag original) m a -> RuntimeImplemented original m a\r\nuntag m = RuntimeImplemented $ ReaderT $ \\orig ->\r\n    implement (EffTag orig) m\r\n"}}}
2018-12-02 23:32:37.9076355 [ThreadId 12] - ****** reactor: got message number:0
2018-12-02 23:32:37.9076355 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Tutorial/Test.hs","languageId":"haskell","version":1,"text":"{-# LANGUAGE FlexibleContexts #-}\r\n{-# LANGUAGE OverloadedStrings #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# LANGUAGE TypeFamilies #-}\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE MultiParamTypeClasses #-}\r\nmodule Tutorial.Test where\r\n\r\nimport Data.Text as T\r\nimport Data.Text.IO as T\r\nimport Control.Monad.IO.Class\r\nimport Control.Effects.State\r\nimport Control.Effects.List\r\nimport Control.Concurrent\r\nimport Control.Monad.Runnable\r\nimport Control.Monad.Trans\r\nimport Control.Monad\r\n\r\naddFruit :: (MonadIO m, MonadEffect (State [Text]) m) => m ()\r\naddFruit = do\r\n    liftIO (T.putStrLn \"Name a type of fruit please\")\r\n    fruit <- liftIO T.getLine\r\n    knownFruits <- getState\r\n    setState (fruit : knownFruits)\r\n\r\nmain1 :: IO ()\r\nmain1 = implementStateViaStateT @[Text] [] $ do\r\n    addFruit\r\n    addFruit\r\n    addFruit\r\n    fruits <- getState @[Text]\r\n    liftIO (print fruits)\r\n\r\nmain2 :: IO ()\r\nmain2 =\r\n    evaluateAll $\r\n    implementStateViaStateT @[Text] [] $ do\r\n        addFruit\r\n        addFruit\r\n        addFruit\r\n        fruits <- getState @[Text]\r\n        fruit <- choose fruits\r\n        liftIO (print fruit)\r\n\r\nmain3 :: IO ()\r\nmain3 = do\r\n    evaluateAll $\r\n        implementStateViaStateT @Int 0 $ do\r\n            setState @Int 1\r\n            choose (Prelude.replicate 3 ())\r\n            setState . succ =<< getState @Int\r\n            liftIO . print =<< getState @Int\r\n    implementStateViaStateT @Int 0 $\r\n        evaluateAll $ do\r\n            setState @Int 1\r\n            choose (Prelude.replicate 3 ())\r\n            setState . succ =<< getState @Int\r\n            liftIO . print =<< getState @Int\r\n\r\nmain4 :: IO ()\r\nmain4 = do\r\n    lst <- evaluateToList $\r\n        implementStateViaStateT @Int 0 $ do\r\n            setState @Int 1\r\n            choose (Prelude.replicate 3 ())\r\n            setState . succ =<< getState @Int\r\n            getState @Int\r\n    print lst\r\n    implementStateViaStateT @Int 0 $ do\r\n        evaluateAll $ do\r\n            setState @Int 1\r\n            choose (Prelude.replicate 3 ())\r\n            setState . succ =<< getState @Int\r\n        liftIO . print =<< getState @Int\r\n\r\nnewtype Fork m = ForkMethods\r\n    { _fork :: m () -> m (Maybe ThreadId) }\r\ninstance Effect Fork where\r\n    type CanLift Fork t = RunnableTrans  t\r\n    mergeContext mm = ForkMethods\r\n        (\\a -> do\r\n            ForkMethods m <- mm\r\n            m a)\r\n    liftThrough (ForkMethods f) = ForkMethods\r\n        (\\a -> do\r\n            st <- currentTransState\r\n            lift (f (void (runTransformer a st)))\r\n            )\r\n\r\ninstance MonadEffect Fork IO where\r\n    effect = ForkMethods (fmap Just . forkIO)\r\n\r\nfork :: MonadEffect Fork m => m () -> m (Maybe ThreadId)\r\nfork = _fork effect\r\n\r\ntestMethod :: (MonadEffects '[State Int, Fork] m, MonadIO m) => m ()\r\ntestMethod = do\r\n    modifyState @Int (+10)\r\n    tid <- void $ fork $ do\r\n        liftIO . print =<< getState @Int\r\n        liftIO $ threadDelay 2000000\r\n        modifyState @Int (+10)\r\n        liftIO . print =<< getState @Int\r\n    liftIO $ threadDelay 1000000\r\n    liftIO $ print tid\r\n    modifyState @Int (+10)\r\n    liftIO . print =<< getState @Int\r\n    liftIO $ threadDelay 3000000\r\n    liftIO . print =<< getState @Int\r\n\r\nmain5 :: IO ()\r\nmain5 = implementStateViaStateT @Int 0 testMethod\r\n"}}}
2018-12-02 23:32:37.9076355 [ThreadId 12] - ****** reactor: processing Initialized Notification
2018-12-02 23:32:37.9076355 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/test/Main.hs","languageId":"haskell","version":1,"text":"{-# LANGUAGE NoMonomorphismRestriction, FlexibleContexts, ScopedTypeVariables, BangPatterns #-}\r\n{-# LANGUAGE DataKinds #-}\r\n{-# LANGUAGE TypeApplications #-}\r\n{-# LANGUAGE DeriveGeneric, DeriveAnyClass, MultiParamTypeClasses, FunctionalDependencies, KindSignatures, TypeFamilies, ConstraintKinds, UndecidableInstances, UndecidableSuperClasses, FlexibleInstances, PolyKinds #-}\r\n{-# LANGUAGE AllowAmbiguousTypes, DerivingStrategies, StandaloneDeriving, GeneralizedNewtypeDeriving #-}\r\nmodule Main where\r\n\r\nimport Control.Monad.IO.Class\r\nimport Control.Monad\r\nimport Control.Effects.Signal\r\nimport Control.Effects.State\r\nimport Control.Effects.Early\r\nimport Control.Effects.Async\r\nimport Control.Effects.List\r\nimport Control.Effects.Yield\r\nimport Control.Effects.Resource\r\nimport Control.Effects.Newtype\r\nimport Control.Concurrent hiding (yield)\r\nimport System.IO\r\nimport GHC.Generics (Generic)\r\nimport Control.Monad.State hiding (State)\r\nimport Data.Kind\r\nimport Data.Function\r\n\r\n-- Should infer\r\nex1 = signal True\r\n\r\n-- Should compile\r\nex2 :: MonadEffect (Throw Bool) m => m ()\r\nex2 = throwSignal False\r\n\r\nex3 = do\r\n    void $ discardAllExceptions ex1\r\n    void $ showAllExceptions ex2\r\n    handleException (\\(_ :: Bool) -> return ()) ex2\r\n    handleSignal (\\(_ :: Bool) -> return $ Resume 5) ex1\r\n\r\n-- Nested Early\r\ntestEarly1 :: Monad m => m Bool\r\ntestEarly1 = handleEarly $ do\r\n    return ()\r\n    _ <- earlyReturn True\r\n    _ <- handleEarly $ do\r\n        return ()\r\n        earlyReturn (123 :: Int)\r\n    _ <- testEarly2\r\n    return True\r\n\r\ntestEarly2 :: Monad m => m Char\r\ntestEarly2 = handleEarly $\r\n    earlyReturn 'a'\r\n\r\norderTest :: (MonadEffects '[HandleException Bool, Throw Bool, State Int] m, MonadIO m) => m ()\r\norderTest = do\r\n    setState (1 :: Int)\r\n    _ :: Either Bool () <- handleToEitherRecursive $ do\r\n        setState (2 :: Int)\r\n        void $ throwSignal True\r\n        setState (3 :: Int)\r\n    st :: Int <- getState\r\n    liftIO (print st)\r\n\r\ninc :: Int -> Int\r\ninc !x = x + 1\r\n\r\ntask :: (MonadEffect (State Int) m) => m Int\r\ntask = do\r\n    replicateM_ 10000000 (modifyState inc)\r\n    st <- getState\r\n    st `seq` return st\r\n\r\nmainParallel :: IO ()\r\nmainParallel = do\r\n    orderTest & handleException (\\(_ :: Bool) -> return ())\r\n              & implementStateViaStateT (0 :: Int)\r\n    orderTest & implementStateViaStateT (0 :: Int)\r\n              & handleException (\\(_ :: Bool) -> return ())\r\n    putStrLn \"Starting sequential test\"\r\n    replicateM_ 8 (implementStateViaStateT (0 :: Int) task >>= print)\r\n    putStrLn \"Sequential test done\"\r\n    putStrLn \"Starting parallel test\"\r\n    implementStateViaStateT (0 :: Int) $ do\r\n        res <- parallelMapM id (replicate 8 task)\r\n        mapM_ (liftIO . print) res\r\n    putStrLn \"Parallel test done\"\r\n\r\nparallelTest ::\r\n    (MonadEffects '[Async thread, NonDeterminism] m, MonadIO m) => m (thread m (Int, Char))\r\nparallelTest = do\r\n    n <- choose [1,2,3,4]\r\n    async $ do\r\n        liftIO $ threadDelay ((5 - n) * 1000000)\r\n        l <- choose \"ab\"\r\n        return (n, l)\r\n\r\nmainAsync :: IO ()\r\nmainAsync = do\r\n    threads <- evaluateToList parallelTest\r\n    forM_ threads $ \\thread ->\r\n        evaluateToList (do\r\n            p <- waitAsync thread\r\n            liftIO $ print p\r\n            )\r\n\r\nyieldTest ::\r\n    (MonadEffects '[Yield Int, Async thread] m, MonadIO m) => m ()\r\nyieldTest = do\r\n    yield @Int 5\r\n    t <- async $ do\r\n        liftIO $ putStrLn \"yielding 6\"\r\n        yield @Int 6\r\n        liftIO $ putStrLn \"yielding 10\"\r\n        yield @Int 10\r\n\r\n    t2 <- async $ do\r\n        liftIO $ putStrLn \"yielding 8\"\r\n        yield @Int 8\r\n        liftIO $ putStrLn \"yielding 9\"\r\n        yield @Int 9\r\n    yield @Int 7\r\n    waitAsync t\r\n    waitAsync t2\r\n    return ()\r\n\r\nmainYield :: IO ()\r\nmainYield = do\r\n    hSetBuffering stdout LineBuffering\r\n    await <- implementYieldViaMVar @Int yieldTest\r\n    traverseYielded_ await $ \\res -> do\r\n        print res\r\n        void getLine\r\n\r\n-- testResource = evaluateAll $ bracket\r\n--     (choose [True, False] >>= \\tf -> liftIO (putStrLn (\"acq \" ++ show tf)) >> return tf)\r\n--     (\\tf _ -> liftIO $ putStrLn (\"cleaning \" ++ show tf))\r\n--     (\\tf -> if tf then liftIO $ putStrLn \"true\" else error \"io err\" >> liftIO (putStrLn \"false\") )\r\n\r\ndata Tricky m = Tricky { tricky :: m () }\r\n    deriving (Generic, Effect)\r\n\r\ntest :: (MonadEffects '[State Int, Tricky] m, MonadIO m) => m ()\r\ntest = do\r\n    x <- getState\r\n    setState (x + 1)\r\n    x <- getState\r\n    liftIO $ print x\r\n    tricky effect >>= liftIO . print\r\n\r\nimplTricky m = tagEffect' @Tricky @(State ()) (implement (Tricky getState) m)\r\n\r\n-- test2 = implTricky test\r\n-- test'' = magic @\"mystate\" @(State Int) (StateMethods readLn print) test\r\n\r\nmain :: IO ()\r\nmain = test\r\n    & implTricky\r\n    & implementStateViaStateT 0\r\n    & untag @Tricky\r\n    & implementStateViaStateT ()\r\n"}}}
2018-12-02 23:32:37.9086565 [ThreadId 12] - Using stack GHC version
2018-12-02 23:32:37.9096338 [ThreadId 5] - <--2--{"jsonrpc":"2.0","params":{"type":4,"message":"Using hie version: Version 0.4.0.1, Git revision 7e0b19721872d1c8e44f49484ac75f6c61412349 (dirty) (2220 commits) x86_64 ghc-8.6.2"},"method":"window/logMessage"}
2018-12-02 23:32:38.1190681 [ThreadId 13] - ghcDispatcher: top of loop
2018-12-02 23:32:38.1370198 [ThreadId 12] - ****** reactor: got message number:1
2018-12-02 23:32:38.1370198 [ThreadId 13] - ghcDispatcher:got request 0 with id: Nothing
2018-12-02 23:32:38.1370198 [ThreadId 12] - ****** reactor: processing NotDidOpenTextDocument
2018-12-02 23:32:38.1380175 [ThreadId 13] - ghcDispatcher: top of loop
2018-12-02 23:32:38.1380175 [ThreadId 12] - requestDiagnostics: no diagFunc for:DiagnosticOnOpen
2018-12-02 23:32:38.1380175 [ThreadId 5] - <--2--{"jsonrpc":"2.0","params":{"type":2,"message":"No hoogle db found. Check the README for instructions to generate one"},"method":"window/showMessage"}
2018-12-02 23:32:38.1380175 [ThreadId 13] - ghcDispatcher:got request 1 with id: Nothing
2018-12-02 23:32:38.1390151 [ThreadId 12] - ****** reactor: got message number:2
2018-12-02 23:32:38.1410091 [ThreadId 12] - ****** reactor: processing NotDidOpenTextDocument
2018-12-02 23:32:38.1420068 [ThreadId 12] - requestDiagnostics: no diagFunc for:DiagnosticOnOpen
2018-12-02 23:32:38.1430043 [ThreadId 12] - ****** reactor: got message number:3
2018-12-02 23:32:38.1440017 [ThreadId 12] - ****** reactor: processing NotDidOpenTextDocument
2018-12-02 23:32:38.1440017 [ThreadId 12] - requestDiagnostics: no diagFunc for:DiagnosticOnOpen
2018-12-02 23:32:38.1440017 [ThreadId 12] - ****** reactor: got message number:4
2018-12-02 23:32:38.1440017 [ThreadId 12] - ****** reactor: processing NotDidOpenTextDocument
2018-12-02 23:32:38.1440017 [ThreadId 12] - requestDiagnostics: no diagFunc for:DiagnosticOnOpen
2018-12-02 23:32:38.3280188 [ThreadId 13] - file mapping state is: fromList [("C:\\Users\\darwi\\Projects\\simple-effects\\src\\Control\\Effects.hs",FileMapping {fmPath = "C:\\Users\\darwi\\AppData\\Local\\Temp\\ghc-mod18201\\Eff63CB.hs", fmTemp = True})]
2018-12-02 23:32:38.3290161 [ThreadId 13] - ghcDispatcher: top of loop
2018-12-02 23:32:38.3290161 [ThreadId 13] - ghcDispatcher:got request 1 with id: Nothing
2018-12-02 23:32:38.3290161 [ThreadId 13] - ghcDispatcher:Processing request as version matches
2018-12-02 23:32:38.4277522 [ThreadId 13] - ghcDispatcher: top of loop
2018-12-02 23:32:38.4287493 [ThreadId 13] - ghcDispatcher:got request 1 with id: Nothing
2018-12-02 23:32:38.4297472 [ThreadId 13] - ghcDispatcher:Processing request as version matches
2018-12-02 23:32:38.4317411 [ThreadId 13] - setTypecheckedModule: file mapping state is: fromList [("C:\\Users\\darwi\\Projects\\simple-effects\\src\\Control\\Effects.hs",FileMapping {fmPath = "C:\\Users\\darwi\\AppData\\Local\\Temp\\ghc-mod18201\\Eff63CB.hs", fmTemp = True})]
2018-12-02 23:32:38.4327394 [ThreadId 13] - setTypecheckedModule: before ghc-mod
2018-12-02 23:32:38.5773516 [ThreadId 5] - <--2--{"jsonrpc":"2.0","params":{"uri":"file:///C%3A/Users/darwi/Projects/simple-effects/src/Control/Effects.hs","diagnostics":[]},"method":"textDocument/publishDiagnostics"}
2018-12-02 23:32:41.0222323 [ThreadId 3] - ---> {"jsonrpc":"2.0","id":1,"method":"textDocument/hover","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs"},"position":{"line":108,"character":23}}}
2018-12-02 23:32:42.4104535 [ThreadId 3] - ---> {"jsonrpc":"2.0","id":2,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs"},"position":{"line":109,"character":0}}}
2018-12-02 23:32:42.883409 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":2},"contentChanges":[{"range":{"start":{"line":109,"character":0},"end":{"line":109,"character":0}},"rangeLength":0,"text":"\r\n"}]}}
2018-12-02 23:32:43.2447217 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":3},"contentChanges":[{"range":{"start":{"line":110,"character":0},"end":{"line":110,"character":0}},"rangeLength":0,"text":"    "}]}}
2018-12-02 23:32:43.6264969 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":4},"contentChanges":[{"range":{"start":{"line":110,"character":4},"end":{"line":110,"character":4}},"rangeLength":0,"text":"f"}]}}
2018-12-02 23:32:43.6275324 [ThreadId 3] - ---> {"jsonrpc":"2.0","id":3,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs"},"position":{"line":110,"character":5},"context":{"triggerKind":1}}}
2018-12-02 23:32:43.900358 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":5},"contentChanges":[{"range":{"start":{"line":110,"character":5},"end":{"line":110,"character":5}},"rangeLength":0,"text":"m"}]}}
2018-12-02 23:32:43.900358 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":3}}
2018-12-02 23:32:43.9013918 [ThreadId 3] - ---> {"jsonrpc":"2.0","id":4,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs"},"position":{"line":110,"character":6},"context":{"triggerKind":1}}}
2018-12-02 23:32:44.1231396 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":6},"contentChanges":[{"range":{"start":{"line":110,"character":6},"end":{"line":110,"character":6}},"rangeLength":0,"text":"a"}]}}
2018-12-02 23:32:44.1231396 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":4}}
2018-12-02 23:32:44.1241372 [ThreadId 3] - ---> {"jsonrpc":"2.0","id":5,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs"},"position":{"line":110,"character":7},"context":{"triggerKind":1}}}
2018-12-02 23:32:44.2368266 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":7},"contentChanges":[{"range":{"start":{"line":110,"character":7},"end":{"line":110,"character":7}},"rangeLength":0,"text":"p"}]}}
2018-12-02 23:32:44.2378217 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":5}}
2018-12-02 23:32:44.2378217 [ThreadId 3] - ---> {"jsonrpc":"2.0","id":6,"method":"textDocument/completion","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs"},"position":{"line":110,"character":8},"context":{"triggerKind":1}}}
2018-12-02 23:32:45.3466791 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":8},"contentChanges":[{"range":{"start":{"line":110,"character":4},"end":{"line":110,"character":8}},"rangeLength":4,"text":""}]}}
2018-12-02 23:32:45.7042072 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":9},"contentChanges":[{"range":{"start":{"line":110,"character":0},"end":{"line":110,"character":4}},"rangeLength":4,"text":""}]}}
2018-12-02 23:32:46.071793 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":10},"contentChanges":[{"range":{"start":{"line":109,"character":0},"end":{"line":110,"character":0}},"rangeLength":2,"text":""}]}}
2018-12-02 23:32:46.4519366 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":11},"contentChanges":[{"range":{"start":{"line":108,"character":29},"end":{"line":109,"character":0}},"rangeLength":2,"text":""}]}}
2018-12-02 23:32:46.7696657 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":12},"contentChanges":[{"range":{"start":{"line":108,"character":29},"end":{"line":108,"character":29}},"rangeLength":0,"text":"\r\n"}]}}
2018-12-02 23:32:46.770663 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/willSave","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs"},"reason":1}}
2018-12-02 23:32:46.8045718 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"textDocument/didSave","params":{"textDocument":{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","version":1}}}
2018-12-02 23:32:46.8336284 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"workspace/didChangeWatchedFiles","params":{"changes":[{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","type":2},{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","type":2}]}}
2018-12-02 23:32:46.8386007 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"workspace/didChangeWatchedFiles","params":{"changes":[{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","type":2},{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","type":2}]}}
2018-12-02 23:32:46.8396008 [ThreadId 3] - ---> {"jsonrpc":"2.0","method":"workspace/didChangeWatchedFiles","params":{"changes":[{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","type":2},{"uri":"file:///C:/Users/darwi/Projects/simple-effects/src/Control/Effects/Newtype.hs","type":2}]}}

If I'm understanding correctly, the executable simply isn't responding. I can see the process running but it's memory usage is at 20Mb so it probably didn't load anything.

lukel97 commented 5 years ago

Have you built the project from the command line before? Looks like its started the build with 2018-12-02 23:32:38.4327394 [ThreadId 13] - setTypecheckedModule: before ghc-mod, and sometimes it can take a while if it's a clean build.

LukaHorvat commented 5 years ago

I did. It builds fine

lukel97 commented 5 years ago

Looks like hie/ghc-mod is getting stuck then, is there a sample project we can try this out on? You can try generating the hoogle DB to see if that might help

LukaHorvat commented 5 years ago

Building the hoogle DB didn't help. Also it doesn't seem project specific. I just made a new project (stack new hietest --bare --resolver=nightly-2018-11-19) and it doesn't work there either. Logs still stop at before ghc-mod.

What else can I try?

lukel97 commented 5 years ago

There is a --vomit option you can try, it causes ghc-mod to output pretty much everything going on to stderr, which I believe appears in the VS Code output window. Not sure where that will show up in Atom

LukaHorvat commented 5 years ago

How can I pass in that flag?

alanz commented 5 years ago

did you install hie via the makefile? GHC 8.6 ships with Cabal-2.4.10, and cabal-helper needs this (and cabal-install) available to use ghc-mod against a project.

The makefile does this on-off install.

question: does the windows make process have this?

LukaHorvat commented 5 years ago

I'm on Windows but I used the makefile, not the PowerShell script.

wz1000 commented 5 years ago

@LukaHorvat In vscode, there should be setting to "Use Custom Hie Wrapper Path". You can point that to a script that runs hie with --vomit

LukaHorvat commented 5 years ago

@wz1000 I've made a hiewrap.bat with hie.exe --vomit %* as contents and set it as the hie wrapper script. I get an error that the server crashed 5 times and the output log says

[Info  - 10:01:48 PM] Connection to server got closed. Server will restart.
'.' is not recognized as an internal or external command,
operable program or batch file.

5 times.

stouf commented 5 years ago

I think I'm facing the same issue on Archlinux. I posted details there

fendor commented 5 years ago

I further noticed, that the test suite dispatcher-test for HIE does not terminate on GHC 8.6.2, and fails on GHC 8.4.4.

LukaHorvat commented 5 years ago

I've been periodically pulling and retrying with the latest master and I'm happy to say that as far as I can tell this is fixed!

I'm going to close this issue, but if it remains broken for others feel free to reopen.