Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {-# Language
- Rank2Types,
- GADTs,
- DataKinds,
- PolyKinds,
- TypeFamilies,
- DatatypeContexts,
- MultiParamTypeClasses,
- UndecidableInstances,
- UndecidableSuperClasses
- #-}
- import GHC.Exts
- data Stream s a = Stream (a,s)
- data Linear s a = Linear (a,s) | End a
- data Stack s a = Stack (a,s) | Empty
- data Basecase s a where
- Stream' :: Stream s a -> Basecase s a
- Linear' :: Linear s a -> Basecase s a
- Stack' :: Stack s a -> Basecase s a
- data Proxy k = Proxy
- class Flat f where -- not considering Nested Base functors yet, so no Trees etc
- type FlatBase f :: Proxy Basecase
- type State (x :: Proxy b) s a = s -> b s a
- type CoState (x :: Proxy b) s a = b s a -> s
- class Flat f => Get f where
- get :: CoState (FlatBase f) (f a) a
- class Flat f => Set f where
- set :: State (FlatBase f) (f a) a
- data (Get f,Set f) => Zipper f a = Zipper [a] (f a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement