thrist (empty) → 0.0
raw patch · 4 files changed
+95/−0 lines, 4 filesdep +basesetup-changed
Dependencies added: base
Files
- Data/Thrist.hs +22/−0
- LICENSE +30/−0
- Setup.lhs +4/−0
- thrist.cabal +39/−0
+ Data/Thrist.hs view
@@ -0,0 +1,22 @@+module Data.Thrist( Thrist(..)+ , foldThrist ) where++import Prelude+-- import Data.Char++data Thrist :: (* -> * -> *) -> * -> * -> * where+ Nil :: Thrist p a a+ Cons :: p a b -> Thrist p b c -> Thrist p a c++foldThrist :: (forall i j k . p i j -> p j k -> p i k) -> p c c -> Thrist p a c -> p a c+foldThrist _ v Nil = v+foldThrist f v (Cons h t) = h `f` (foldThrist f v t)++{- Simple demo:+t1 :: Thrist (->) Char Char+t1 = ord `Cons` ((\i -> i+32) `Cons` (chr `Cons` Nil))++t2 :: Char -> Char+t2 = foldThrist (flip (.)) id t1+-}+
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2008 Gabor Greif++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions+are met:++1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the distribution.++3. Neither the name of the author nor the names of his contributors+ may be used to endorse or promote products derived from this software+ without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE+POSSIBILITY OF SUCH DAMAGE.
+ Setup.lhs view
@@ -0,0 +1,4 @@+#! /usr/bin/env runhaskell+ +> import Distribution.Simple+> main = defaultMain
+ thrist.cabal view
@@ -0,0 +1,39 @@+Name: thrist+Version: 0.0+Synopsis: Type-threaded list++Description:+ 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.+ .+ For further ideas, please consult the companion+ (draft) paper \"Thrists: Dominoes of Data\" at+ <http://www.opendylan.org/~gabor/Thrist-draft-2008-07-18.pdf>++Category: Data Structures+License: BSD3+License-File: LICENSE+Copyright: (c) 2008 Gabor Greif++Author: Gabor Greif+Maintainer: ggreif@gmail.com+Homepage: http://heisenbug.blogspot.com/search/label/thrist++Stability: experimental+Build-Depends: base+Extensions: GADTs++Exposed-Modules: Data.Thrist+Ghc-Options: -Wall++Build-Type: Simple+