-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Type-threaded list -- -- Thrist is a list-like data structure (GADT) whose elements are values -- of a two-parameter datatype. The typing constraint ensures that the -- second type parameter of a former value unifies with the first type -- parameter of the latter. -- -- This threading of types is the foundation for thrists' nice -- properties. E.g., paired with a suitable semantics, function -- composition (.) can be embedded. -- -- Sub-modules demonstrate the power of the thrist idea by emulating some -- familiar data structures. -- -- For further ideas, please consult the companion (draft) paper -- "Thrists: Dominoes of Data" at -- http://omega.googlecode.com/files/Thrist-draft-2011-11-20.pdf @package thrist @version 0.2.2 module Data.Thrist.Monad data Monad' :: (* -> *) -> * -> * -> * Feed :: m b -> Monad' m a b Digest :: (a -> m b) -> Monad' m a b module Data.Thrist -- | A type-threaded list of binary polymorphic types. data Thrist :: (* -> * -> *) -> * -> * -> * Nil :: Thrist ~> a a Cons :: (a ~> b) -> Thrist ~> b c -> Thrist ~> a c -- | A newtype wrapper, defined for convenience, that swaps the two -- type variables of a binary type. Can be used to reverse a Thrist using -- foldlThrist. See examples. newtype Flipped m a b Flipped :: m b a -> Flipped m a b unflip :: Flipped m a b -> m b a -- | Equivalent to map for thrists. Takes a function from one binary -- type to another and applies it to each thrist element. For example -- this could convert a thrist of (a,b) into a thrist of Either a b: mapThrist :: (forall i j. (i +> j) -> (i ~> j)) -> Thrist +> a b -> Thrist ~> a b -- | Equivalent to foldr for thrists. Takes a combining function, a -- value to replace Nil, and a thrist, returning some new binary type. foldrThrist :: (forall i j. (i ~> j) -> (j +> c) -> (i +> c)) -> (b +> c) -> Thrist ~> a b -> (a +> c) -- | Equivalent to foldl for Thrists. foldlThrist :: (forall j k. (a +> j) -> (j ~> k) -> (a +> k)) -> (a +> b) -> Thrist ~> b c -> (a +> c) -- | Equivalent to foldr1 for Thrists. foldr1Thrist :: (forall i j k. (i ~> j) -> (j ~> k) -> (i ~> k)) -> Thrist ~> a b -> (a ~> b) -- | Equivalent to foldl1 for Thrists. foldl1Thrist :: (forall i j k. (i ~> j) -> (j ~> k) -> (i ~> k)) -> Thrist ~> a b -> (a ~> b) -- | Equivalent to mapM on Thrists. mapMThrist :: Monad m => (forall i j. (i +> j) -> m (i ~> j)) -> Thrist +> a b -> m (Thrist ~> a b) -- | Equivalent to foldM on Thrists. foldMThrist :: Monad m => (forall j k. (a +> j) -> (j ~> k) -> m (a +> k)) -> (a +> b) -> Thrist ~> b c -> m (a +> c) -- | Equivalent to (++) for thrists. appendThrist :: Thrist ~> a b -> Thrist ~> b c -> Thrist ~> a c -- | Returns True when the Thrist is Nil. nullThrist :: Thrist ~> a b -> Bool instance Category (Thrist (~>)) instance Arrow (~>) => Arrow (Thrist (~>)) instance Monoid (Thrist (~>) a a) module Data.Thrist.List data List :: * -> * -> * El :: a -> List a a instance Monad List'