packages feed

thrist 0.1 → 0.1.1

raw patch · 3 files changed

+46/−15 lines, 3 filesdep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

- Data.Thrist: instance Monoid (Thrist p a a)
+ Data.Thrist: instance Arrow (Thrist (->))
+ Data.Thrist: instance Category (Thrist (~>))
+ Data.Thrist: instance Monoid (Thrist (~>) a a)
+ Data.Thrist: mapThrist :: (forall i j. i +> j -> i ~> j) -> Thrist +> a b -> Thrist ~> a b
- Data.Thrist: Cons :: p a b -> Thrist p b c -> Thrist p a c
+ Data.Thrist: Cons :: (a ~> b) -> Thrist ~> b c -> Thrist ~> a c
- Data.Thrist: Nil :: Thrist p a a
+ Data.Thrist: Nil :: Thrist ~> a a
- Data.Thrist: appendThrist :: Thrist p a b -> Thrist p b c -> Thrist p a c
+ Data.Thrist: appendThrist :: Thrist ~> a b -> Thrist ~> b c -> Thrist ~> a c
- Data.Thrist: foldThrist :: (forall i j k. p i j -> p j k -> p i k) -> p c c -> Thrist p a c -> p a c
+ Data.Thrist: foldThrist :: (forall i j k. (i ~> j) -> (j ~> k) -> (i ~> k)) -> c ~> c -> Thrist ~> a c -> a ~> c

Files

Data/Thrist.hs view
@@ -1,16 +1,23 @@ module Data.Thrist ( Thrist (..)                    , foldThrist-                   , appendThrist ) where+                   , appendThrist+                   , mapThrist ) where  import Prelude import Data.Monoid+import Control.Category -- import Data.Char+import Control.Arrow  data Thrist :: (* -> * -> *) -> * -> * -> * where-  Nil :: Thrist p a a-  Cons :: p a b -> Thrist p b c -> Thrist p a c+  Nil :: Thrist (~>) a a+  Cons :: (a ~> b) -> Thrist (~>) b c -> Thrist (~>) 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 :: (forall i j k . (i ~> j) -> (j ~> k) -> (i ~> k))+              -> c ~> c+              -> Thrist (~>) a c+              -> a ~> c foldThrist _ v Nil = v foldThrist f v (Cons h t) = h `f` (foldThrist f v t) @@ -22,16 +29,40 @@ t2 = foldThrist (flip (.)) id t1 -} -appendThrist :: forall (p :: * -> * -> *) a b c .-                Thrist p a b ->-                Thrist p b c ->-                Thrist p a c+appendThrist :: forall ((~>) :: * -> * -> *) a b c .+                Thrist (~>) a b ->+                Thrist (~>) b c ->+                Thrist (~>) a c  appendThrist Nil a = a appendThrist (Cons b r) a = Cons b (appendThrist r a) +mapThrist :: (forall i j . i +> j -> i ~> j) -> Thrist (+>) a b -> Thrist (~>) a b+mapThrist _ Nil = Nil+mapThrist f (Cons a r) = Cons (f a) (mapThrist f r) -instance Monoid (Thrist p a a) where++instance Monoid (Thrist (~>) a a) where   mempty = Nil   mappend = appendThrist +instance Arrow (Thrist (->)) where+  arr f = Cons f Nil+  first Nil = Nil+  first (Cons f _) = Cons (f *** Control.Category.id) undefined++{-+class Category cat where+  id :: cat a a+  (.) :: cat b c -> cat a b -> cat a c+  (<<<) :: Category cat => cat b c -> cat a b -> cat a c+  (>>>) :: Category cat => cat a b -> cat b c -> cat a c+-}++instance Category (Thrist (~>)) where+  id = Nil+  b . a = appendThrist a b+  --  below methods are defaulted:+  --+  ---  b <<< a = appendThrist a b+  ---  a >>> b = appendThrist a b
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2008 Gabor Greif+Copyright (c) 2008-2009 Gabor Greif  All rights reserved. 
thrist.cabal view
@@ -1,5 +1,5 @@ Name:                thrist-Version:             0.1+Version:             0.1.1 Synopsis:            Type-threaded list  Description:@@ -22,18 +22,18 @@ Category:            Data Structures License:             BSD3 License-File:        LICENSE-Copyright:           (c) 2008 Gabor Greif+Copyright:           (c) 2008-2009 Gabor Greif  Author:              Gabor Greif Maintainer:          ggreif@gmail.com Homepage:            http://heisenbug.blogspot.com/search/label/thrist  Stability:           experimental-Build-Depends:       base-Extensions:          GADTs, RankNTypes, KindSignatures, FlexibleInstances+Build-Depends:       base >= 4 && < 5+Extensions:          GADTs, RankNTypes, KindSignatures, FlexibleInstances, TypeOperators, FlexibleContexts  Exposed-Modules:     Data.Thrist Ghc-Options:         -Wall+Cabal-Version:       >= 1.2.3  Build-Type:          Simple-