on master help sign in
Better GADT signatures
commit96b2bb3498cc7f1381df87e50215a078bafe151a authorAndrzej Rybczak <andrzej@rybczak.net> dateMon 26 Jul 2021, 15:13 (5 years ago) parent5cb1e35
3 files changed+5−3
effectful-core/src/Effectful/Internal/Effect.hs+1−1 effectful-core/src/Effectful/Internal/Env.hs+2−1 effectful/src/Effectful/Async.hs+2−1
effectful-core/src/Effectful/Internal/Effect.hs+1−1
@@ -18,7 +18,7 @@ import GHC.TypeLits
1818type Effect = (Type -> Type) -> Type -> Type
1919
2020-- | Adapter for statically dispatched effects.
21−newtype IdE (e :: Effect) where
21+newtype IdE :: Effect -> Type where
2222 IdE :: (forall m r. e m r) -> IdE e
2323
2424-- | A constraint that requires that a particular effect, @e@, is a member of
effectful-core/src/Effectful/Internal/Env.hs+2−1
@@ -30,6 +30,7 @@ module Effectful.Internal.Env
3030import Control.Monad
3131import Control.Monad.Primitive
3232import Data.IORef
33+import Data.Kind
3334import Data.Primitive.SmallArray
3435import GHC.Exts (Any)
3536import GHC.Stack (HasCallStack)
@@ -149,7 +150,7 @@ newForkId (ForkIdGen ref) = do
149150----------------------------------------
150151-- Relinker
151152
152−newtype Relinker i (e :: Effect) where
153+newtype Relinker :: (Effect -> Type) -> Effect -> Type where
153154 Relinker
154155 :: ((forall es. Env es -> IO (Env es)) -> handler e -> IO (handler e))
155156 -> Relinker handler e
effectful/src/Effectful/Async.hs+2−1
@@ -76,6 +76,7 @@ import Control.Concurrent (threadDelay)
7676import Control.Concurrent.Async (Async)
7777import Control.Exception (Exception, SomeException)
7878import Control.Monad (forever)
79+import Data.Kind
7980import qualified Control.Concurrent.Async as A
8081import qualified UnliftIO.Async as U
8182import qualified UnliftIO.Internals.Async as I
@@ -449,7 +450,7 @@ pooledReplicateConcurrently_ n f = unsafeEff $ \es -> do
449450-- Conc
450451
451452-- | Lifted 'U.Conc'.
452−data Conc es a where
453+data Conc :: [Effect] -> Type -> Type where
453454 Action :: Eff es a -> Conc es a
454455 Apply :: Conc es (v -> a) -> Conc es v -> Conc es a
455456 LiftA2 :: (x -> y -> a) -> Conc es x -> Conc es y -> Conc es a