git.iko.soy/distributed-process
on master help sign in
Add Functor instance for Match data type
commit81bcb23086657a6153af9fe1e610cd86e61968ca authorAlexey Khudyakov <alexey.skladnoy@gmail.com> dateWed 24 Jun 2015, 20:00 (11 years ago) parent13428ac
2 files changed+4
src/Control/Distributed/Process/Internal/CQueue.hs+2 src/Control/Distributed/Process/Internal/Primitives.hs+2
src/Control/Distributed/Process/Internal/CQueue.hs+2
@@ -1,3 +1,4 @@
1+{-# LANGUAGE DeriveFunctor #-}
12{-# LANGUAGE BangPatterns #-}
23{-# LANGUAGE MagicHash, UnboxedTuples, PatternGuards, ScopedTypeVariables, RankNTypes #-}
34-- | Concurrent queue for single reader, single writer
@@ -77,6 +78,7 @@ data BlockSpec =
7778data MatchOn m a
7879 = MatchMsg (m -> Maybe a)
7980 | MatchChan (STM a)
81+ deriving (Functor)
8082
8183type MatchChunks m a = [Either [m -> Maybe a] [STM a]]
8284
src/Control/Distributed/Process/Internal/Primitives.hs+2
@@ -1,6 +1,7 @@
11{-# LANGUAGE CPP #-}
22{-# LANGUAGE RankNTypes #-}
33{-# LANGUAGE DeriveDataTypeable #-}
4+{-# LANGUAGE DeriveFunctor #-}
45{-# LANGUAGE ScopedTypeVariables #-}
56{-# LANGUAGE ExistentialQuantification #-}
67{-# LANGUAGE BangPatterns #-}
@@ -374,6 +375,7 @@ mergePortsRR = \ps -> do
374375
375376-- | Opaque type used in 'receiveWait' and 'receiveTimeout'
376377newtype Match b = Match { unMatch :: MatchOn Message (Process b) }
378+ deriving (Functor)
377379
378380-- | Test the matches in order against each message in the queue
379381receiveWait :: [Match b] -> Process b