[fix] associativity for infix operators.

This commit is contained in:
Yamada Ryo 2024-07-07 04:50:34 +09:00
parent cf5f17072f
commit e6d83f21aa
No known key found for this signature in database
GPG Key ID: AAE3C7A542B02DBF
8 changed files with 17 additions and 22 deletions

View File

@ -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

View File

@ -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 $ "<runDummyFS> mkdir " <> path

View File

@ -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

View File

@ -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 #-}

View File

@ -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 #-}

View File

@ -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 #-}

View File

@ -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 #-}

View File

@ -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 #-}