Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 59f09cc

Browse files
committed
🔥 NamingC & runNaming.
1 parent baa675f commit 59f09cc

1 file changed

Lines changed: 0 additions & 18 deletions

File tree

semantic-core/src/Data/Name.hs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,9 @@ module Data.Name
1717
, fresh
1818
, namespace
1919
, Naming(..)
20-
, runNaming
21-
, NamingC(..)
2220
) where
2321

2422
import Control.Effect.Carrier
25-
import Control.Effect.Reader
26-
import Control.Effect.State
27-
import Control.Monad.Fail
28-
import Control.Monad.IO.Class
2923
import qualified Data.Char as Char
3024
import Data.HashSet (HashSet)
3125
import qualified Data.HashSet as HashSet
@@ -133,15 +127,3 @@ instance HFunctor Naming where
133127
instance Effect Naming where
134128
handle state handler (Fresh k) = Fresh (handler . (<$ state) . k)
135129
handle state handler (Namespace s m k) = Namespace s (handler (m <$ state)) (handler . fmap k)
136-
137-
138-
runNaming :: Functor m => NamingC m a -> m a
139-
runNaming = runReader Nil . evalState 0 . runNamingC
140-
141-
newtype NamingC m a = NamingC { runNamingC :: StateC Int (ReaderC (Stack Text) m) a }
142-
deriving (Applicative, Functor, Monad, MonadFail, MonadIO)
143-
144-
instance (Carrier sig m, Effect sig) => Carrier (Naming :+: sig) (NamingC m) where
145-
eff (L (Fresh k)) = NamingC (asks Gensym <*> get <* modify (succ @Int) >>= runNamingC . k)
146-
eff (L (Namespace s m k)) = NamingC (StateC (\ i -> local (:> s) (evalState 0 (runNamingC m)) >>= runState i . runNamingC . k))
147-
eff (R other) = NamingC (eff (R (R (handleCoercible other))))

0 commit comments

Comments
 (0)