Rename RR to Romap

This commit is contained in:
Frederik Hanghøj Iversen 2018-03-06 09:55:18 +01:00
parent c57cd5c991
commit bdd67aee53

View file

@ -166,23 +166,23 @@ module Kleisli {a b : Level} ( : Category a b) where
-- are not generally types.
record RawMonad : Set where
field
RR : Object Object
Romap : Object Object
-- Note name-change from [voe]
pure : {X : Object} [ X , RR X ]
bind : {X Y : Object} [ X , RR Y ] [ RR X , RR Y ]
pure : {X : Object} [ X , Romap X ]
bind : {X Y : Object} [ X , Romap Y ] [ Romap X , Romap Y ]
-- | functor map
--
-- This should perhaps be defined in a "Klesli-version" of functors as well?
fmap : {A B} [ A , B ] [ RR A , RR B ]
fmap : {A B} [ A , B ] [ Romap A , Romap B ]
fmap f = bind (pure f)
-- | Composition of monads aka. the kleisli-arrow.
_>=>_ : {A B C : Object} [ A , RR B ] [ B , RR C ] [ A , RR C ]
_>=>_ : {A B C : Object} [ A , Romap B ] [ B , Romap C ] [ A , Romap C ]
f >=> g = f >>> (bind g)
-- | Flattening nested monads.
join : {A : Object} [ RR (RR A) , RR A ]
join : {A : Object} [ Romap (Romap A) , Romap A ]
join = bind 𝟙
------------------
@ -192,10 +192,10 @@ module Kleisli {a b : Level} ( : Category a b) where
-- There may be better names than what I've chosen here.
IsIdentity = {X : Object}
bind pure 𝟙 {RR X}
IsNatural = {X Y : Object} (f : [ X , RR Y ])
bind pure 𝟙 {Romap X}
IsNatural = {X Y : Object} (f : [ X , Romap Y ])
pure >>> (bind f) f
IsDistributive = {X Y Z : Object} (g : [ Y , RR Z ]) (f : [ X , RR Y ])
IsDistributive = {X Y Z : Object} (g : [ Y , Romap Z ]) (f : [ X , Romap Y ])
(bind f) >>> (bind g) bind (f >=> g)
-- | Functor map fusion.
@ -239,7 +239,7 @@ module Kleisli {a b : Level} ( : Category a b) where
-- | This formulation gives rise to the following endo-functor.
private
rawR : RawFunctor
RawFunctor.func* rawR = RR
RawFunctor.func* rawR = Romap
RawFunctor.func→ rawR = fmap
isFunctorR : IsFunctor rawR
@ -401,23 +401,21 @@ module _ {a b : Level} { : Category a b} where
module M = Monoidal
module K = Kleisli
-- Note similarity with locally defined things in Kleisly.RawMonad!!
module _ (m : M.RawMonad) where
open M.RawMonad m
forthRaw : K.RawMonad
K.RawMonad.RR forthRaw = Romap
K.RawMonad.Romap forthRaw = Romap
K.RawMonad.pure forthRaw = pureT _
K.RawMonad.bind forthRaw = bind
module _ {raw : M.RawMonad} (m : M.IsMonad raw) where
private
module MI = M.IsMonad m
module KI = K.IsMonad
forthIsMonad : K.IsMonad (forthRaw raw)
KI.isIdentity forthIsMonad = proj₂ MI.isInverse
KI.isNatural forthIsMonad = MI.isNatural
KI.isDistributive forthIsMonad = MI.isDistributive
K.IsMonad.isIdentity forthIsMonad = proj₂ MI.isInverse
K.IsMonad.isNatural forthIsMonad = MI.isNatural
K.IsMonad.isDistributive forthIsMonad = MI.isDistributive
forth : M.Monad K.Monad
Kleisli.Monad.raw (forth m) = forthRaw (M.Monad.raw m)
@ -476,7 +474,7 @@ module _ {a b : Level} { : Category a b} where
bind
where
joinT = proj₁ joinNT
lem : (f : Arrow X (RR Y)) bind (f >>> pure) >>> bind 𝟙 bind f
lem : (f : Arrow X (Romap Y)) bind (f >>> pure) >>> bind 𝟙 bind f
lem f = begin
bind (f >>> pure) >>> bind 𝟙
≡⟨ isDistributive _ _
@ -492,7 +490,7 @@ module _ {a b : Level} { : Category a b} where
x & f = f x
forthRawEq : forthRaw (backRaw m) K.Monad.raw m
K.RawMonad.RR (forthRawEq _) = RR
K.RawMonad.Romap (forthRawEq _) = Romap
K.RawMonad.pure (forthRawEq _) = pure
-- stuck
K.RawMonad.bind (forthRawEq i) = bindEq i