Rename get* to run*

This commit is contained in:
Kiana Sheibani 2023-03-06 16:44:26 -05:00
parent 3558ea1741
commit ebc5de6b2c
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
4 changed files with 14 additions and 14 deletions

View file

@ -30,7 +30,7 @@ yon h s = (fst h s, snd h s)
public export
record Closure p a b where
constructor MkClosure
getClosure : forall x. p (x -> a) (x -> b)
runClosure : forall x. p (x -> a) (x -> b)
export
@ -55,7 +55,7 @@ Strong p => GenStrong Pair (Closure p) where
export
Profunctor p => Closed (Closure p) where
closed p = getClosure $ produplicate p
closed p = runClosure $ produplicate p
export
Profunctor p => Functor (Closure p a) where
@ -68,7 +68,7 @@ close f p = MkClosure $ f $ closed p
export
unclose : Profunctor q => p :-> Closure q -> p :-> q
unclose f p = dimap const ($ ()) $ getClosure $ f p
unclose f p = dimap const ($ ()) $ runClosure $ f p
-- Environment

View file

@ -88,7 +88,7 @@ GenStrong Either Tagged where
public export
record GenTambara (ten, p : Type -> Type -> Type) a b where
constructor MkTambara
getTambara : forall c. p (a `ten` c) (b `ten` c)
runTambara : forall c. p (a `ten` c) (b `ten` c)
export
Bifunctor ten => Profunctor p => Profunctor (GenTambara ten p) where
@ -120,7 +120,7 @@ gentambara @{gs} f x = MkTambara $ f $ strongl @{gs} x
export
ungentambara : Tensor ten i => Profunctor q => p :-> GenTambara ten q -> p :-> q
ungentambara f x = dimap unitr.bwd unitr.fwd $ getTambara $ f x
ungentambara f x = dimap unitr.bwd unitr.fwd $ runTambara $ f x
public export

View file

@ -30,38 +30,38 @@ import Data.Profunctor.Closed
record Bazaar a b t where
constructor MkBazaar
getBazaar : forall f. Applicative f => (a -> f b) -> f t
runBazaar : forall f. Applicative f => (a -> f b) -> f t
Functor (Bazaar a b) where
map f (MkBazaar g) = MkBazaar (map f . g)
Applicative (Bazaar a b) where
pure a = MkBazaar $ \_ => pure a
mf <*> ma = MkBazaar $ \k => getBazaar mf k <*> getBazaar ma k
mf <*> ma = MkBazaar $ \k => runBazaar mf k <*> runBazaar ma k
sell : a -> Bazaar a b b
sell a = MkBazaar ($ a)
record Baz t b a where
constructor MkBaz
getBaz : forall f. Applicative f => (a -> f b) -> f t
runBaz : forall f. Applicative f => (a -> f b) -> f t
Functor (Baz t b) where
map f (MkBaz g) = MkBaz (g . (. f))
sold : Baz t a a -> t
sold m = runIdentity (getBaz m Id)
sold m = runIdentity (runBaz m Id)
Foldable (Baz t b) where
foldr f i bz = getBaz bz @{appEndo} f i
foldr f i bz = runBaz bz @{appEndo} f i
where
-- Equivalent to `Const (Endomorphism acc)`
appEndo : Applicative (\_ => acc -> acc)
appEndo = MkApplicative @{MkFunctor (const id)} (const id) (.)
Traversable (Baz t b) where
traverse f bz = map (\m => MkBaz (getBazaar m)) $ getBaz bz @{Compose} $ \x => sell <$> f x
traverse f bz = map (\m => MkBaz (runBazaar m)) $ runBaz bz @{Compose} $ \x => sell <$> f x
public export
@ -78,7 +78,7 @@ interface (Strong p, Choice p) => Traversing p where
public export
record CofreeTraversing p a b where
constructor MkCFT
getCFT : forall f. Traversable f => p (f a) (f b)
runCFT : forall f. Traversable f => p (f a) (f b)
export
Profunctor p => Profunctor (CofreeTraversing p) where

View file

@ -109,7 +109,7 @@ Functor f => Profunctor (Costar f) where
public export
record Tagged {0 k : Type} (a : k) b where
constructor Tag
getTagged : b
runTagged : b
public export
retag : Tagged a c -> Tagged b c
@ -126,7 +126,7 @@ Applicative (Tagged a) where
export
Monad (Tagged a) where
join = getTagged
join = runTagged
Tag x >>= f = f x
export