Skip to content

Instantly share code, notes, and snippets.

@dminuoso
Last active February 1, 2019 23:11
Show Gist options
  • Save dminuoso/ac6d72cf8d83d96b84ecdc23ed44cae2 to your computer and use it in GitHub Desktop.
Save dminuoso/ac6d72cf8d83d96b84ecdc23ed44cae2 to your computer and use it in GitHub Desktop.
data Store s a = Store (s -> a) s
-- Read out the store at some specific position
peek :: s -> Store s a -> a
peek = _
-- Modify the current focus, and read the store using the new focus.
peeks :: (s -> s) -> Store s a -> a
peeks = _
-- Set the current focus
seek :: s -> Store s a -> Store s a
seek = _
-- Modify the current focus
seeks :: (s -> s) -> Store s a -> Store s a
seeks = _
-- Run an experiment in the store.
experiment :: Functor f => (s -> f s) -> Store s a -> f a
experiment = _
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment