Maintainer | Bas van Dijk <v.dijk.bas@gmail.com> |
---|
WARNING: This module should not be used by end-users directly because it
allows access to the internalHandle
of a resource which enables them to
close the resource manually, which will defeat the safety-guarantees that
this package provides!
- internalHandle :: RegionalHandle resource r -> Handle resource
- mapInternalHandle :: (Handle resource1 -> Handle resource2) -> RegionalHandle resource1 r -> RegionalHandle resource2 r
Documentation
internalHandle :: RegionalHandle resource r -> Handle resourceSource
Get the internal handle from the given regional handle.
Warning: This function should not be exported to or used by end-users because it allows them to close the handle manually, which will defeat the safety-guarantees that this package provides!
Tip: If you enable the ViewPatterns
language extension you can use
internalHandle
as a view-pattern as in the following example from the
usb-safe
package:
resetDevice :: (pr `ParentOf` cr, MonadIO cr) -> RegionalHandle USB.Device pr -> cr () resetDevice (internalHandle -> (DeviceHandle ...)) = ...
mapInternalHandle :: (Handle resource1 -> Handle resource2) -> RegionalHandle resource1 r -> RegionalHandle resource2 rSource
Modify the internal handle from the given regional handle.