hpio-0.9.0.2: Monads for GPIO in Haskell

Copyright(c) 2017 Quixoftic LLC
LicenseBSD3
MaintainerDrew Hess <dhess-src@quixoftic.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellTrustworthy
LanguageHaskell2010

System.GPIO.Linux.Sysfs.IO

Contents

Description

The actual Linux sysfs implementation. This implementation will only function properly on Linux systems with a sysfs subsystem, obviously.

Synopsis

SysfsIOT transformer

newtype SysfsIOT m a Source #

An instance of MonadSysfs which runs MonadSysfs operations in IO. This instance must be run on an actual Linux sysfs GPIO filesystem and will fail in any other environment.

Interactions with threads

Some parts of this implementation use the Haskell C FFI, and may block on C I/O operations. (Specifically, pollFile will block in the C FFI until its event is triggered.) When using this implementation with GHC, you should compile your program with the -threaded option, so that threads performing these blocking operations do not block other Haskell threads in the system.

Note that the C FFI bits in this implementation are marked as interruptible, so that, on versions of GHC later than 7.8.1, functions such as throwTo will work properly when targeting a Haskell thread that uses this implementation.

(On Haskell implementations other than GHC, the threading implications are unknown; see the implementation's notes on how its threading system interacts with the C FFI.)

Constructors

SysfsIOT 

Fields

Instances

MonadTrans SysfsIOT Source # 

Methods

lift :: Monad m => m a -> SysfsIOT m a #

MonadTransControl SysfsIOT Source # 

Associated Types

type StT (SysfsIOT :: (* -> *) -> * -> *) a :: * #

Methods

liftWith :: Monad m => (Run SysfsIOT -> m a) -> SysfsIOT m a #

restoreT :: Monad m => m (StT SysfsIOT a) -> SysfsIOT m a #

MonadRWS r w s m => MonadRWS r w s (SysfsIOT m) Source # 
MonadBaseControl b m => MonadBaseControl b (SysfsIOT m) Source # 

Associated Types

type StM (SysfsIOT m :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase (SysfsIOT m) b -> b a) -> SysfsIOT m a #

restoreM :: StM (SysfsIOT m) a -> SysfsIOT m a #

MonadBase b m => MonadBase b (SysfsIOT m) Source # 

Methods

liftBase :: b α -> SysfsIOT m α #

MonadError e m => MonadError e (SysfsIOT m) Source # 

Methods

throwError :: e -> SysfsIOT m a #

catchError :: SysfsIOT m a -> (e -> SysfsIOT m a) -> SysfsIOT m a #

MonadReader r m => MonadReader r (SysfsIOT m) Source # 

Methods

ask :: SysfsIOT m r #

local :: (r -> r) -> SysfsIOT m a -> SysfsIOT m a #

reader :: (r -> a) -> SysfsIOT m a #

MonadState s m => MonadState s (SysfsIOT m) Source # 

Methods

get :: SysfsIOT m s #

put :: s -> SysfsIOT m () #

state :: (s -> (a, s)) -> SysfsIOT m a #

MonadWriter w m => MonadWriter w (SysfsIOT m) Source # 

Methods

writer :: (a, w) -> SysfsIOT m a #

tell :: w -> SysfsIOT m () #

listen :: SysfsIOT m a -> SysfsIOT m (a, w) #

pass :: SysfsIOT m (a, w -> w) -> SysfsIOT m a #

Monad m => Monad (SysfsIOT m) Source # 

Methods

(>>=) :: SysfsIOT m a -> (a -> SysfsIOT m b) -> SysfsIOT m b #

(>>) :: SysfsIOT m a -> SysfsIOT m b -> SysfsIOT m b #

return :: a -> SysfsIOT m a #

fail :: String -> SysfsIOT m a #

Functor m => Functor (SysfsIOT m) Source # 

Methods

fmap :: (a -> b) -> SysfsIOT m a -> SysfsIOT m b #

(<$) :: a -> SysfsIOT m b -> SysfsIOT m a #

MonadFix m => MonadFix (SysfsIOT m) Source # 

Methods

mfix :: (a -> SysfsIOT m a) -> SysfsIOT m a #

Applicative m => Applicative (SysfsIOT m) Source # 

Methods

pure :: a -> SysfsIOT m a #

(<*>) :: SysfsIOT m (a -> b) -> SysfsIOT m a -> SysfsIOT m b #

(*>) :: SysfsIOT m a -> SysfsIOT m b -> SysfsIOT m b #

(<*) :: SysfsIOT m a -> SysfsIOT m b -> SysfsIOT m a #

Alternative m => Alternative (SysfsIOT m) Source # 

Methods

empty :: SysfsIOT m a #

(<|>) :: SysfsIOT m a -> SysfsIOT m a -> SysfsIOT m a #

some :: SysfsIOT m a -> SysfsIOT m [a] #

many :: SysfsIOT m a -> SysfsIOT m [a] #

MonadPlus m => MonadPlus (SysfsIOT m) Source # 

Methods

mzero :: SysfsIOT m a #

mplus :: SysfsIOT m a -> SysfsIOT m a -> SysfsIOT m a #

MonadIO m => MonadIO (SysfsIOT m) Source # 

Methods

liftIO :: IO a -> SysfsIOT m a #

MonadThrow m => MonadThrow (SysfsIOT m) Source # 

Methods

throwM :: Exception e => e -> SysfsIOT m a #

MonadCatch m => MonadCatch (SysfsIOT m) Source # 

Methods

catch :: Exception e => SysfsIOT m a -> (e -> SysfsIOT m a) -> SysfsIOT m a #

MonadMask m => MonadMask (SysfsIOT m) Source # 

Methods

mask :: ((forall a. SysfsIOT m a -> SysfsIOT m a) -> SysfsIOT m b) -> SysfsIOT m b #

uninterruptibleMask :: ((forall a. SysfsIOT m a -> SysfsIOT m a) -> SysfsIOT m b) -> SysfsIOT m b #

MonadLogger m => MonadLogger (SysfsIOT m) Source # 

Methods

monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> SysfsIOT m () #

MonadLoggerIO m => MonadLoggerIO (SysfsIOT m) Source # 

Methods

askLoggerIO :: SysfsIOT m (Loc -> LogSource -> LogLevel -> LogStr -> IO ()) #

MonadCont m => MonadCont (SysfsIOT m) Source # 

Methods

callCC :: ((a -> SysfsIOT m b) -> SysfsIOT m a) -> SysfsIOT m a #

(MonadIO m, MonadThrow m) => MonadSysfs (SysfsIOT m) Source # 
type StT SysfsIOT a Source # 
type StT SysfsIOT a = a
type StM (SysfsIOT m) a Source # 
type StM (SysfsIOT m) a = ComposeSt SysfsIOT m a