From e6d83f21aa09b43ea59536ef17d7b622adddecc7 Mon Sep 17 00:00:00 2001 From: Yamada Ryo Date: Sun, 7 Jul 2024 04:50:34 +0900 Subject: [PATCH] [fix] associativity for infix operators. --- cabal.project | 2 +- heftia-effects/Example/Logging/Main.hs | 8 ++++---- heftia/src/Control/Effect/ExtensibleChurch.hs | 4 ++-- heftia/src/Control/Effect/ExtensibleFastA.hs | 5 ++--- heftia/src/Control/Effect/ExtensibleFinal.hs | 5 ++--- heftia/src/Control/Effect/ExtensibleFinalA.hs | 5 ++--- heftia/src/Control/Effect/ExtensibleTree.hs | 5 ++--- heftia/src/Control/Effect/ExtensibleTreeA.hs | 5 ++--- 8 files changed, 17 insertions(+), 22 deletions(-) diff --git a/cabal.project b/cabal.project index 2d0abf3..c2a4f3d 100644 --- a/cabal.project +++ b/cabal.project @@ -5,7 +5,7 @@ packages: source-repository-package type: git location: https://github.com/sayo-hs/data-effects - tag: 6890ba050c9f430eb2932723681de1a2b7f6a415 + tag: 9b098c118bf768447fc8372d2e8f1c2e6e63eeb3 subdir: data-effects-core subdir: data-effects-th subdir: data-effects diff --git a/heftia-effects/Example/Logging/Main.hs b/heftia-effects/Example/Logging/Main.hs index 1b0281e..746edaf 100644 --- a/heftia-effects/Example/Logging/Main.hs +++ b/heftia-effects/Example/Logging/Main.hs @@ -39,7 +39,7 @@ data Time a where makeEffectF [''Time] -timeToIO :: (IO <| r, ForallHFunctor eh) => eh :!! (LTime ': r) ~> eh :!! r +timeToIO :: (IO <| r, ForallHFunctor eh) => eh :!! LTime ': r ~> eh :!! r timeToIO = interpretRec \CurrentTime -> sendIns getCurrentTime logWithTime :: (Log <| ef, Time <| ef, ForallHFunctor eh) => eh :!! ef ~> eh :!! ef @@ -58,12 +58,12 @@ data LogChunk f (a :: Type) where makeEffectH [''LogChunk] -- | Ignore chunk names and output logs in log chunks as they are. -runLogChunk :: ForallHFunctor eh => (LogChunk ': eh) :!! ef ~> eh :!! ef +runLogChunk :: ForallHFunctor eh => LogChunk ': eh :!! ef ~> eh :!! ef runLogChunk = interpretRecH \(LogChunk _ m) -> m -- | Limit the number of logs in a log chunk to the first @n@ logs. limitLogChunk - :: forall eh ef. (LogChunk <<| eh, Log <| {- LState Int ': -} ef) => + :: forall eh ef. (LogChunk <<| eh, Log <| ef) => Int -> LogChunk ('[] :!! ef) ~> LogChunk ('[] :!! ef) limitLogChunk n (LogChunk chunkName a) = LogChunk chunkName . evalState @Int 0 $ @@ -82,7 +82,7 @@ data FileSystem a where makeEffectF [''FileSystem] -runDummyFS :: (IO <| r, ForallHFunctor eh) => eh :!! (LFileSystem ': r) ~> eh :!! r +runDummyFS :: (IO <| r, ForallHFunctor eh) => eh :!! LFileSystem ': r ~> eh :!! r runDummyFS = interpretRec \case Mkdir path -> sendIns $ putStrLn $ " mkdir " <> path diff --git a/heftia/src/Control/Effect/ExtensibleChurch.hs b/heftia/src/Control/Effect/ExtensibleChurch.hs index 562568c..e42b4bb 100644 --- a/heftia/src/Control/Effect/ExtensibleChurch.hs +++ b/heftia/src/Control/Effect/ExtensibleChurch.hs @@ -31,8 +31,8 @@ infixr 4 ! type ehs :!! efs = Eff ExtensibleUnion FreerChurch ehs efs type (:!) efs = EffF ExtensibleUnion FreerChurch efs -infixr 5 :!! -infixr 4 :! +infixr 4 :!! +infixr 3 :! runEff :: Monad f => '[] :!! '[LiftIns f] ~> f runEff = H.runEff diff --git a/heftia/src/Control/Effect/ExtensibleFastA.hs b/heftia/src/Control/Effect/ExtensibleFastA.hs index 3defefc..bdfd9a6 100644 --- a/heftia/src/Control/Effect/ExtensibleFastA.hs +++ b/heftia/src/Control/Effect/ExtensibleFastA.hs @@ -33,9 +33,8 @@ infixr 4 ! type ehs :!! efs = Eff ExtensibleUnion Ap ehs efs type (:!) efs = EffF ExtensibleUnion Ap efs -infixr 5 :!! -infixr 4 :! - +infixr 4 :!! +infixr 3 :! runEff :: Applicative f => '[] :!! '[LiftIns f] ~> f runEff = H.runEff {-# INLINE runEff #-} diff --git a/heftia/src/Control/Effect/ExtensibleFinal.hs b/heftia/src/Control/Effect/ExtensibleFinal.hs index 9946ba4..722d27d 100644 --- a/heftia/src/Control/Effect/ExtensibleFinal.hs +++ b/heftia/src/Control/Effect/ExtensibleFinal.hs @@ -31,9 +31,8 @@ infixr 4 ! type ehs :!! efs = Eff ExtensibleUnion (FreerFinal Monad) ehs efs type (:!) efs = EffF ExtensibleUnion (FreerFinal Monad) efs -infixr 5 :!! -infixr 4 :! - +infixr 4 :!! +infixr 3 :! runEff :: Monad f => '[] :!! '[LiftIns f] ~> f runEff = H.runEff {-# INLINE runEff #-} diff --git a/heftia/src/Control/Effect/ExtensibleFinalA.hs b/heftia/src/Control/Effect/ExtensibleFinalA.hs index c06188b..93fc720 100644 --- a/heftia/src/Control/Effect/ExtensibleFinalA.hs +++ b/heftia/src/Control/Effect/ExtensibleFinalA.hs @@ -31,9 +31,8 @@ infixr 4 ! type ehs :!! efs = Eff ExtensibleUnion (FreerFinal Applicative) ehs efs type (:!) efs = EffF ExtensibleUnion (FreerFinal Applicative) efs -infixr 5 :!! -infixr 4 :! - +infixr 4 :!! +infixr 3 :! runEff :: Applicative f => '[] :!! '[LiftIns f] ~> f runEff = H.runEff {-# INLINE runEff #-} diff --git a/heftia/src/Control/Effect/ExtensibleTree.hs b/heftia/src/Control/Effect/ExtensibleTree.hs index e3c7fe6..8e89677 100644 --- a/heftia/src/Control/Effect/ExtensibleTree.hs +++ b/heftia/src/Control/Effect/ExtensibleTree.hs @@ -31,9 +31,8 @@ infixr 4 ! type ehs :!! efs = Eff ExtensibleUnion FreerTree ehs efs type (:!) efs = EffF ExtensibleUnion FreerTree efs -infixr 5 :!! -infixr 4 :! - +infixr 4 :!! +infixr 3 :! runEff :: Monad f => '[] :!! '[LiftIns f] ~> f runEff = H.runEff {-# INLINE runEff #-} diff --git a/heftia/src/Control/Effect/ExtensibleTreeA.hs b/heftia/src/Control/Effect/ExtensibleTreeA.hs index cfe6a15..6f19e5d 100644 --- a/heftia/src/Control/Effect/ExtensibleTreeA.hs +++ b/heftia/src/Control/Effect/ExtensibleTreeA.hs @@ -34,9 +34,8 @@ infixr 4 ! type ehs :!! efs = Eff ExtensibleUnion Ap ehs efs type (:!) efs = EffF ExtensibleUnion Ap efs -infixr 5 :!! -infixr 4 :! - +infixr 4 :!! +infixr 3 :! runEff :: Applicative f => '[] :!! '[LiftIns f] ~> f runEff = H.runEff {-# INLINE runEff #-}