Hello Haskell Friends,
Recently I noticed some strange behavior in a program that uses peek/poke to manipulate memory mapped hardware registers, that smells a lot like missing volatile semantics to me. It hadn’t occurred to me that peek/poke might not have volatile semantics (they return an IO, and that IO has to happen, right?), but naturally once they’re lowered all such bets are off. This made me wonder:
- Do we have a type like #Addr whose loads/stores have volatile semantics?
- Do we have any primops with volatile semantics at all?
- Are there any tricks one could use to get volatile semantics out of base’s peek/poke functions?
Poking around, I’m afraid the answer to all three of these is “no.” If so, I’d be very interested in contributing volatile load/store primops and working out some way to make them easily available from Foreign.Storable. Does no such thing currently exist or am I missing something?
Thanks for all your ongoing efforts,
Travis