Module
Control.Comonad.Transformerless.Env
- Package
- purescript-transformerless
- Repository
- thimoteus/purescript-transformerless
#Env Source
newtype Env e a
Constructors
Instances
Newtype (Env e a) _
Functor (Env e)
Extend (Env e)
Comonad (Env e)
Law: extract <<= xs = xs Proof: LHS := extend extract xs = extend extract (x1, x2) = (x1, extract (x1, x2)) = (x1, x2) RHS := (x1, x2) Law: extract (f <<= xs) = f xs Proof: LHS := extract (extend f xs) = extract (extend f (x1, x2)) = extract (x1, f (x1, x2)) = f (x1, x2) RHS := f (x1, x2)
Law: extend f <<< extend g = extend (f <<< extend g) Proof: First, rewrite in pointful form: (extend f <<< extend g) x = extend (f <<< extend g) x RHS := extend (f <<< extend g) x = extend (\ y -> f (extend g y)) x = extend (\ (y1, y2) -> f (extend g (y1, y2))) (x1, x2) = extend (\ (y1, y2) -> f (y1, g (y1, y2))) (x1, x2) = (x1, (\ (y1, y2) -> f (y1, g (y1, y2))) (x1, x2)) = (x1, f (x1, g (x1, x2))) LHS := (\ y -> extend f (extend g y)) x = (\ (y1, y2) -> extend f (extend g (y1, y2))) (x1, x2) = (\ (y1, y2) -> extend f (y1, g (y1, y2))) (x1, x2) = (\ (y1, y2) -> (y1, f (y1, g (y1, y2)))) (x1, x2) = (x1, f (x1, g (x1, x2)))