Portability | portable |
---|---|

Stability | provisional |

Maintainer | Edward Kmett <ekmett@gmail.com> |

The array-backed store (state-in-context/costate) comonad transformer is subject to the laws:

x = seek (pos x) x y = pos (seek y x) seek y x = seek y (seek z x)

Thanks go to Russell O'Connor and Daniel Peebles for their help formulating and proving the laws for this comonad transformer.

This basic version of this transformer first appeared on Dan Piponi's blog at http://blog.sigfpe.com/2008/03/comonadic-arrays.html.

Since this module relies on the non-Haskell 98 `arrays`

package, it is
located here instead of in comonad-transformers.

NB: attempting to seek or peek out of bounds will yield an error.

- type Pointer i = PointerT i Identity
- pointer :: Array i a -> i -> Pointer i a
- runPointer :: Pointer i a -> (Array i a, i)
- data PointerT i w a = PointerT (w (Array i a)) i
- runPointerT :: PointerT i w a -> (w (Array i a), i)
- pointerBounds :: (Comonad w, Ix i) => PointerT i w a -> (i, i)
- module Control.Comonad.Store.Class

# The Pointer comonad

runPointer :: Pointer i a -> (Array i a, i)Source

# The Pointer comonad transformer

(ComonadEnv m w, Ix i) => ComonadEnv m (PointerT i w) | |

(Comonad w, Ix i) => ComonadStore i (PointerT i w) | |

(ComonadTraced m w, Ix i) => ComonadTraced m (PointerT i w) | |

Ix i => ComonadHoist (PointerT i) | |

Ix i => ComonadTrans (PointerT i) | |

(Functor w, Ix i) => Functor (PointerT i w) | |

(Typeable i, Typeable1 w) => Typeable1 (PointerT i w) | |

(Comonad w, Ix i) => Comonad (PointerT i w) | |

(Comonad w, Ix i) => Extend (PointerT i w) | |

(Typeable i, Typeable1 w, Typeable a) => Typeable (PointerT i w a) |

runPointerT :: PointerT i w a -> (w (Array i a), i)Source

pointerBounds :: (Comonad w, Ix i) => PointerT i w a -> (i, i)Source

Extract the bounds of the currently focused array

module Control.Comonad.Store.Class