Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Executing commands within the Car Monad.
Synopsis
- newtype Time = Time (Finite 1440)
- mkTime :: Finite 24 -> Finite 60 -> Time
- fromTime :: Time -> (Finite 24, Finite 60)
- newtype Percent = Percent (Finite 101)
- mkPercent :: Integral n => n -> Maybe Percent
- runCmd :: MonadIO m => String -> [Pair] -> Car m CommandResponse
- runCmd' :: MonadIO m => String -> Car m CommandResponse
- type CommandResponse = Either Text ()
- data Car m a
- (.=) :: (KeyValue kv, ToJSON v) => Key -> v -> kv
- mkCommand :: String -> String -> Q [Dec]
- mkCommands :: [String] -> Q [Dec]
- mkNamedCommands :: [(String, String)] -> Q [Dec]
Documentation
Data type representing local time in minutes since midnight.
Time (Finite 1440) |
Instances
ToJSON Time Source # | |
Defined in Tesla.Car.Command | |
Num Time Source # | |
Show Time Source # | |
FormValue Time Source # | |
Defined in Tesla.Car.Command renderFormValue :: Time -> ByteString |
A type representing a whole number percnetage between 0 and 100 (inclusive).
Percent (Finite 101) |
Instances
ToJSON Percent Source # | |
Defined in Tesla.Car.Command toEncoding :: Percent -> Encoding toJSONList :: [Percent] -> Value toEncodingList :: [Percent] -> Encoding | |
Read Percent Source # | |
Show Percent Source # | |
runCmd :: MonadIO m => String -> [Pair] -> Car m CommandResponse Source #
Run a command with a JSON payload.
type CommandResponse = Either Text () Source #
A CommandResponse wraps an Either such that Left represents a failure message and Right suggests the command was successful.
Car Monad for accessing car-specific things.
Instances
MonadFail m => MonadFail (Car m) Source # | |
MonadIO m => MonadIO (Car m) Source # | |
Applicative m => Applicative (Car m) Source # | |
Functor m => Functor (Car m) Source # | |
Monad m => Monad (Car m) Source # | |
MonadCatch m => MonadCatch (Car m) Source # | |
MonadMask m => MonadMask (Car m) Source # | |
MonadThrow m => MonadThrow (Car m) Source # | |
MonadLogger m => MonadLogger (Car m) Source # | |
Defined in Tesla.Car monadLoggerLog :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> Car m () | |
MonadUnliftIO m => MonadUnliftIO (Car m) Source # | |
TH support for generating commands.
mkCommand :: String -> String -> Q [Dec] Source #
Build a simple named command car that posts to the given named endpoint.
mkCommands :: [String] -> Q [Dec] Source #
Build a bunch of commands from a list of named endpoints, defining functions by removing the common prefix.
Orphan instances
FormValue Bool Source # | |
renderFormValue :: Bool -> ByteString |