Explorar el Código

tower backend: allow readable attr to be used just via underlying ChanOutput

- makes it easier to integrate attrs with code written for generic tower chans
Pat Hickey hace 9 años
padre
commit
fb38344b42
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      support/tower/Attr.hs.template

+ 3 - 0
support/tower/Attr.hs.template

@@ -74,14 +74,17 @@ instance AttrNamed Attr where
 class AttrReadable p where
   attrState   :: (IvoryArea a, IvoryZero a) => p a -> Monitor e (Ref Global a)
   attrHandler :: (IvoryArea a, IvoryZero a) => p a -> Handler a e () -> Monitor e ()
+  attrReaderChan :: p a -> ChanOutput a
 
 instance AttrReadable AttrReader where
   attrState = attrReaderState
   attrHandler = attrReaderHandler
+  attrReaderChan = ar_chan
 
 instance AttrReadable Attr where
   attrState = attrReaderState . attr_reader
   attrHandler p k = attrReaderHandler (attr_reader p) k
+  attrReaderChan = attrReaderChan . attr_reader
 
 class AttrWritable p where
   attrEmitter :: (IvoryArea a, IvoryZero a) => p a -> Handler b e (Emitter a)