mirror of
https://github.com/github/semantic.git
synced 2025-01-07 07:58:12 +03:00
📝 channel types in Go
This commit is contained in:
parent
845f1c966e
commit
596c4535ab
@ -9,6 +9,7 @@ import Data.Functor.Classes.Show.Generic
|
||||
import Data.Mergeable
|
||||
import GHC.Generics
|
||||
|
||||
-- | A Bidirectional channel in Go (e.g. `chan`).
|
||||
newtype BiDirectionalChannel a = BiDirectionalChannel { biDirectionalChannelElementType :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
@ -16,6 +17,7 @@ instance Eq1 BiDirectionalChannel where liftEq = genericLiftEq
|
||||
instance Ord1 BiDirectionalChannel where liftCompare = genericLiftCompare
|
||||
instance Show1 BiDirectionalChannel where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A Receive channel in Go (e.g. `<-chan`).
|
||||
newtype ReceiveChannel a = ReceiveChannel { receiveChannelElementType :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
@ -23,6 +25,7 @@ instance Eq1 ReceiveChannel where liftEq = genericLiftEq
|
||||
instance Ord1 ReceiveChannel where liftCompare = genericLiftCompare
|
||||
instance Show1 ReceiveChannel where liftShowsPrec = genericLiftShowsPrec
|
||||
|
||||
-- | A Send channel in Go (e.g. `chan<-`).
|
||||
newtype SendChannel a = SendChannel { sendChannelElementType :: a }
|
||||
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user