git.iko.soy/distributed-process
on master help sign in
Add Functor instance for Match data type
81bcb23Alexey Khudyakov
src/Control/Distributed/Process/Internal/CQueue.hs+2
@@ -1,3 +1,4 @@
1+{-# LANGUAGE DeriveFunctor #-}
1{-# LANGUAGE BangPatterns #-}
2{-# LANGUAGE BangPatterns #-}
2{-# LANGUAGE MagicHash, UnboxedTuples, PatternGuards, ScopedTypeVariables, RankNTypes #-}
3{-# LANGUAGE MagicHash, UnboxedTuples, PatternGuards, ScopedTypeVariables, RankNTypes #-}
3-- | Concurrent queue for single reader, single writer
4-- | Concurrent queue for single reader, single writer
@@ -77,6 +78,7 @@ data BlockSpec =
77data MatchOn m a
78data MatchOn m a
78 = MatchMsg (m -> Maybe a)
79 = MatchMsg (m -> Maybe a)
79 | MatchChan (STM a)
80 | MatchChan (STM a)
81+ deriving (Functor)
80
82
81type MatchChunks m a = [Either [m -> Maybe a] [STM a]]
83type MatchChunks m a = [Either [m -> Maybe a] [STM a]]
82
84
src/Control/Distributed/Process/Internal/Primitives.hs+2
@@ -1,6 +1,7 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2{-# LANGUAGE RankNTypes #-}
2{-# LANGUAGE RankNTypes #-}
3{-# LANGUAGE DeriveDataTypeable #-}
3{-# LANGUAGE DeriveDataTypeable #-}
4+{-# LANGUAGE DeriveFunctor #-}
4{-# LANGUAGE ScopedTypeVariables #-}
5{-# LANGUAGE ScopedTypeVariables #-}
5{-# LANGUAGE ExistentialQuantification #-}
6{-# LANGUAGE ExistentialQuantification #-}
6{-# LANGUAGE BangPatterns #-}
7{-# LANGUAGE BangPatterns #-}
@@ -374,6 +375,7 @@ mergePortsRR = \ps -> do
374
375
375-- | Opaque type used in 'receiveWait' and 'receiveTimeout'
376-- | Opaque type used in 'receiveWait' and 'receiveTimeout'
376newtype Match b = Match { unMatch :: MatchOn Message (Process b) }
377newtype Match b = Match { unMatch :: MatchOn Message (Process b) }
378+ deriving (Functor)
377
379
378-- | Test the matches in order against each message in the queue
380-- | Test the matches in order against each message in the queue
379receiveWait :: [Match b] -> Process b
381receiveWait :: [Match b] -> Process b