由于State monad可分解为乘积(左-函子)和阅读器(右-可表示)。 有没有一种方法可以使Continuation Monad分解?下面的代码是我的尝试,它不会类型检查 -- To form a -> (a -> k) -> k {-# LANGUAGE MultiParamTypeClasses, TypeOperators, InstanceSigs, TypeSynonymInstances #-} type (<-:) o i = i -> o -- I Dont think we can have Functor & Representable for this type synonym class Isomorphism a b where from :: …
该Applicative类型类代表松懈monoidal函子是保留对输入功能类别的笛卡尔monoidal结构。 换句话说,给定的规范同构见证(,)形成一个单面结构: -- Implementations left to the motivated reader assoc_fwd :: ((a, b), c) -> (a, (b, c)) assoc_bwd :: (a, (b, c)) -> ((a, b), c) lunit_fwd :: ((), a) -> a lunit_bwd :: a -> ((), a) runit_fwd :: (a, ()) -> a runit_bwd :: a -> (a, …