summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilFreeman <>2014-03-29 16:11:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2014-03-29 16:11:00 (GMT)
commit11d05310d58784661ca891c7ce828e81496763f0 (patch)
treecd5c099107571162066b348bb51aed76475206ca
parent765bd6db09e13546e02b6858beaec98963233027 (diff)
version 0.0.2HEAD0.0.2master
-rw-r--r--pattern-arrows.cabal2
-rw-r--r--src/Control/PatternArrows.hs6
2 files changed, 6 insertions, 2 deletions
diff --git a/pattern-arrows.cabal b/pattern-arrows.cabal
index 13e9805..5934e30 100644
--- a/pattern-arrows.cabal
+++ b/pattern-arrows.cabal
@@ -1,5 +1,5 @@
name: pattern-arrows
-version: 0.0.1
+version: 0.0.2
cabal-version: >=1.4
build-type: Simple
license: MIT
diff --git a/src/Control/PatternArrows.hs b/src/Control/PatternArrows.hs
index c42d5d6..d382c19 100644
--- a/src/Control/PatternArrows.hs
+++ b/src/Control/PatternArrows.hs
@@ -29,7 +29,11 @@ import Control.Arrow ((***), (<+>))
--
-- A pattern is a Kleisli arrow for the @StateT Maybe@ monad. That is, patterns can fail, and can carry user-defined state.
--
-newtype Pattern u a b = Pattern { runPattern :: A.Kleisli (StateT u Maybe) a b } deriving (C.Category, A.Arrow, A.ArrowZero, A.ArrowPlus)
+newtype Pattern u a b = Pattern { runPattern :: A.Kleisli (StateT u Maybe) a b } deriving (A.Arrow, A.ArrowZero, A.ArrowPlus)
+
+instance C.Category (Pattern u) where
+ id = Pattern (C.id)
+ Pattern p1 . Pattern p2 = Pattern (p1 C.. p2)
instance Functor (Pattern u a) where
fmap f (Pattern p) = Pattern $ A.Kleisli $ fmap f . A.runKleisli p