Skip to content

Instantly share code, notes, and snippets.

View Davorak's full-sized avatar

Patrick Wheeler Davorak

View GitHub Profile
@sjoerdvisscher
sjoerdvisscher / zipper.hs
Created January 11, 2012 23:10
A zipper for traversables.
import Data.Traversable
import Control.Monad.Free
import Control.Comonad
import Control.Comonad.Trans.Store
type Zipper t a = Free (Store a) (t a)
zipper :: Traversable t => t a -> Zipper t a
zipper = traverse (wrap . store return)