never executed always true always false
    1 module PureClaw.Channels.Class
    2   ( -- * Channel typeclass
    3     Channel (..)
    4     -- * Existential wrapper
    5   , SomeChannel (..)
    6   , someChannelHandle
    7   ) where
    8 
    9 import PureClaw.Handles.Channel
   10 
   11 -- | Typeclass for channel implementations. Each channel knows how to
   12 -- receive messages from users and send responses back. The 'toHandle'
   13 -- method converts any channel into the uniform 'ChannelHandle' used
   14 -- by the agent loop.
   15 class Channel c where
   16   -- | Convert this channel into a 'ChannelHandle'.
   17   toHandle :: c -> ChannelHandle
   18 
   19 -- | Existential wrapper for runtime channel selection (e.g. from config).
   20 -- Use 'someChannelHandle' to extract the 'ChannelHandle'.
   21 data SomeChannel where
   22   MkChannel :: Channel c => c -> SomeChannel
   23 
   24 -- | Extract a 'ChannelHandle' from a 'SomeChannel'.
   25 someChannelHandle :: SomeChannel -> ChannelHandle
   26 someChannelHandle (MkChannel c) = toHandle c