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 public export
record Closure p a b where record Closure p a b where
constructor MkClosure constructor MkClosure
getClosure : forall x. p (x -> a) (x -> b) runClosure : forall x. p (x -> a) (x -> b)
export export
@ -55,7 +55,7 @@ Strong p => GenStrong Pair (Closure p) where
export export
Profunctor p => Closed (Closure p) where Profunctor p => Closed (Closure p) where
closed p = getClosure $ produplicate p closed p = runClosure $ produplicate p
export export
Profunctor p => Functor (Closure p a) where Profunctor p => Functor (Closure p a) where
@ -68,7 +68,7 @@ close f p = MkClosure $ f $ closed p
export export
unclose : Profunctor q => p :-> Closure q -> p :-> q 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 -- Environment

View file

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

View file

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

View file

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