hpio-0.9.0.7: Monads for GPIO in Haskell

Copyright(c) 2018 Drew Hess
LicenseBSD3
MaintainerDrew Hess <src@drewhess.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 # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

Methods

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

MonadTransControl SysfsIOT Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

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 #

(MonadReader r m, MonadWriter w m, MonadState s m) => MonadRWS r w s (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

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

Defined in System.GPIO.Linux.Sysfs.IO

Methods

liftBase :: b α -> SysfsIOT m α #

MonadBaseControl b m => MonadBaseControl b (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

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 #

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

Defined in System.GPIO.Linux.Sysfs.IO

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 #

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

Defined in System.GPIO.Linux.Sysfs.IO

Methods

get :: SysfsIOT m s #

put :: s -> SysfsIOT m () #

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

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

Defined in System.GPIO.Linux.Sysfs.IO

Methods

ask :: SysfsIOT m r #

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

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

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

Defined in System.GPIO.Linux.Sysfs.IO

Methods

throwError :: e -> SysfsIOT m a #

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

Monad m => Monad (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

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 # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

Methods

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

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

MonadFix m => MonadFix (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

Methods

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

Applicative m => Applicative (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

Methods

pure :: a -> SysfsIOT m a #

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

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

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

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

Alternative m => Alternative (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

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 # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

Methods

mzero :: SysfsIOT m a #

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

MonadIO m => MonadIO (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

Methods

liftIO :: IO a -> SysfsIOT m a #

MonadThrow m => MonadThrow (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

Methods

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

MonadCatch m => MonadCatch (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

Methods

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

MonadMask m => MonadMask (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

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 #

generalBracket :: SysfsIOT m a -> (a -> ExitCase b -> SysfsIOT m c) -> (a -> SysfsIOT m b) -> SysfsIOT m (b, c) #

MonadLogger m => MonadLogger (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

Methods

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

MonadLoggerIO m => MonadLoggerIO (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

Methods

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

MonadCont m => MonadCont (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

Methods

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

(MonadIO m, MonadThrow m) => MonadSysfs (SysfsIOT m) Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

type StT SysfsIOT a Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

type StT SysfsIOT a = a
type StM (SysfsIOT m) a Source # 
Instance details

Defined in System.GPIO.Linux.Sysfs.IO

type StM (SysfsIOT m) a = ComposeSt SysfsIOT m a