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)
    1. Law: extend f <<< extend g = extend (f <<< extend g)
    2. Proof:
    3. First, rewrite in pointful form:
    4. (extend f <<< extend g) x = extend (f <<< extend g) x
    5. RHS := extend (f <<< extend g) x =
    6. extend (\ y -> f (extend g y)) x =
    7. extend (\ (y1, y2) -> f (extend g (y1, y2))) (x1, x2) =
    8. extend (\ (y1, y2) -> f (y1, g (y1, y2))) (x1, x2) =
    9. (x1, (\ (y1, y2) -> f (y1, g (y1, y2))) (x1, x2)) =
    10. (x1, f (x1, g (x1, x2)))
    11. LHS := (\ y -> extend f (extend g y)) x =
    12. (\ (y1, y2) -> extend f (extend g (y1, y2))) (x1, x2) =
    13. (\ (y1, y2) -> extend f (y1, g (y1, y2))) (x1, x2) =
    14. (\ (y1, y2) -> (y1, f (y1, g (y1, y2)))) (x1, x2) =
    15. (x1, f (x1, g (x1, x2)))
  • Comonad (Env e)
    1. Law: extract <<= xs = xs
    2. Proof:
    3. LHS := extend extract xs =
    4. extend extract (x1, x2) =
    5. (x1, extract (x1, x2)) =
    6. (x1, x2)
    7. RHS := (x1, x2)
    8. Law: extract (f <<= xs) = f xs
    9. Proof:
    10. LHS := extract (extend f xs) =
    11. extract (extend f (x1, x2)) =
    12. extract (x1, f (x1, x2)) =
    13. f (x1, x2)
    14. RHS := f (x1, x2)

#runEnv Source

runEnv :: forall a e. Env e a -> Tuple e a

#withEnv Source

withEnv :: forall a e2 e1. (e1 -> e2) -> Env e1 a -> Env e2 a

#mapEnv Source

mapEnv :: forall e b a. (a -> b) -> Env e a -> Env e b

#env Source

env :: forall e a. e -> a -> Env e a

#ask Source

ask :: forall e a. Env e a -> e

#asks Source

asks :: forall e2 e1 a. (e1 -> e2) -> Env e1 a -> e2

#local Source

local :: forall a e. (e -> e) -> Env e a -> Env e a