I'm getting started with Netwire version 5.
I have no problem writing all the wires I want to transform my inputs into my outputs.
Now the time has come to write the IO wrapper to tie in my real-world inputs, and I am a bit confused.
Am I supposed to create a custom session type for the s
parameter of Wire s e m a b
and embed my sensor values in there?
If so, I have these questions:
- What's up with the
Monoid s
context ofclass (Monoid s, Real t) => HasTime t s | s -> t
? What is it used for? - I was thinking of tacking on a
Map String Double
with my sensor readings, but how should my monoid crunch the dictionaries? Should it be left-biased? Right-biased? None of the above?
If not, what am I supposed to do? I want to end up with wires of the form Wire s InhibitionReason Identity () Double
for some s
, representing my input.
It's my understanding that I don't want or need to use the monadic m
parameter of Wire
for this purpose, allowing the wires themselves to be pure and confining the IO to the code that steps through the top-level wire(s). Is this incorrect?
runReader
(orrunReaderT
if you wanna stuff in even more stuff). – KimberykimblemkGen_
withgetKey
in it. I would be interested in generalizing the question to: "What are advantages and disadvantages of allowing IO actions inside wires, as compared to feeding all IO data as input to the outermost wire?" – Emulsifier