summaryrefslogtreecommitdiff
path: root/src
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 /src
parent765bd6db09e13546e02b6858beaec98963233027 (diff)
version 0.0.2HEAD0.0.2master
Diffstat (limited to 'src')
-rw-r--r--src/Control/PatternArrows.hs6
1 files changed, 5 insertions, 1 deletions
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