-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Arduino programming in haskell using the Copilot stream DSL
--   
--   arduino-copilot contains the basic building blocks to program your
--   Arduino Nano, Arduino Uno or compatible hardware using Haskell and
--   Functional Reactive Programming (FRP).
--   
--   arduino-copilot uses the Copilot stream DSL (domain-specific language)
--   to generate an Arduino sketch, which can be loaded in the Arduino IDE
--   and uploaded to the board. Other methods of deploying sketches to the
--   Arduino, such as the Arduino-Makefile, can also be used with a sketch
--   generated by arduino-copilot.
--   
--   All the messy details are abstracted away, letting you focus on the
--   desired behavior of the Arduino.
--   
--   Copilot is a stream (i.e., infinite lists) domain-specific language
--   (DSL) in Haskell that compiles into embedded C. Copilot contains an
--   interpreter, multiple back-end compilers, and other verification
--   tools. <a>https://copilot-language.github.io/</a>
@package arduino-copilot
@version 1.7.9


-- | You should not need to import this module unless you're adding support
--   for a new model of Arduino, or an Arduino library.
module Copilot.Arduino.Internals

-- | An Arduino sketch, implemented using Copilot.
--   
--   It's best to think of the <a>Sketch</a> as a description of the state
--   of the board at any point in time.
--   
--   Under the hood, the <a>Sketch</a> is run in a loop. On each iteration,
--   it first reads inputs and then updates outputs as needed.
--   
--   While it is a monad, a Sketch's outputs are not updated in any
--   particular order, because Copilot does not guarantee any order.
type Sketch = GenSketch Arduino

-- | A pin on the Arduino board.
--   
--   For definitions of pins like <a>pin12</a>, load a module such as
--   Copilot.Arduino.Uno, which provides the pins of a particular board.
--   
--   A type-level list indicates how a Pin can be used, so the haskell
--   compiler will detect impossible uses of pins.
newtype Pin (t :: k)
Pin :: Arduino -> Pin (t :: k)

-- | Indicates that you're programming an arduino, and not some other kind
--   of hardware. The similar library zephyr-copilot allows programming
--   other embedded boards in a very similar style to this one.
newtype Arduino
Arduino :: Int16 -> Arduino

-- | Value read from an Arduino's ADC. Ranges from 0-1023.
type ADC = Int16

-- | The framework of a sketch.
type Framework = GenFramework Arduino
class ShowCType (t :: k)
showCType :: ShowCType t => Proxy t -> String
type Behavior t = Stream t
data TypedBehavior (p :: k) t
TypedBehavior :: Behavior t -> TypedBehavior (p :: k) t
data Event (p :: k) v
Event :: v -> Stream Bool -> Event (p :: k) v
class IsBehavior behavior
(@:) :: IsBehavior behavior => behavior -> Behavior Bool -> BehaviorToEvent behavior
class Input ctx o t
input' :: Input ctx o t => o -> [t] -> GenSketch ctx (Behavior t)
input :: Input ctx o t => o -> GenSketch ctx (Behavior t)
class Output ctx o t
(=:) :: Output ctx o t => o -> t -> GenSketch ctx ()
delay :: Delay
data MilliSeconds
MilliSeconds :: Stream Word32 -> MilliSeconds
data MicroSeconds
MicroSeconds :: Stream Word32 -> MicroSeconds
type family IsDigitalIOPin (t :: [PinCapabilities])
type family IsAnalogInputPin (t :: [PinCapabilities])
type family IsPWMPin (t :: [PinCapabilities])
blinking :: Behavior Bool
firstIteration :: Behavior Bool
frequency :: Integer -> Behavior Bool
sketchSpec :: Context ctx => GenSketch ctx a -> Spec
liftB :: (Behavior a -> Behavior r) -> TypedBehavior t a -> Behavior r
liftB2 :: (Behavior a -> Behavior b -> Behavior r) -> TypedBehavior t a -> TypedBehavior t b -> Behavior r
whenB :: Context ctx => Behavior Bool -> GenSketch ctx t -> GenSketch ctx t
scheduleB :: (Typed t, Eq t, Context ctx) => Behavior t -> [(t, GenSketch ctx ())] -> GenSketch ctx ()
class IfThenElse (t :: Type -> Type) a
ifThenElse :: IfThenElse t a => Behavior Bool -> t a -> t a -> t a
newtype GenSketch ctx t
GenSketch :: WriterT [(TriggerLimit -> Spec, TriggerLimit -> GenFramework ctx)] (State UniqueIds) t -> GenSketch ctx t
data GenFramework ctx
Framework :: [CChunk] -> [CChunk] -> [CChunk] -> Map ctx (Set PinMode) -> [CChunk] -> GenFramework ctx
[defines] :: GenFramework ctx -> [CChunk]
[setups] :: GenFramework ctx -> [CChunk]
[earlySetups] :: GenFramework ctx -> [CChunk]
[pinmodes] :: GenFramework ctx -> Map ctx (Set PinMode)
[loops] :: GenFramework ctx -> [CChunk]
class Ord ctx => Context ctx
defineTriggerAlias' :: String -> String -> GenFramework ctx -> GenSketch ctx (GenFramework ctx, String)
emptyFramework :: Context ctx => GenFramework ctx
data PinMode
InputMode :: PinMode
InputPullupMode :: PinMode
OutputMode :: PinMode
addTriggerLimit :: TriggerLimit -> Behavior Bool -> Behavior Bool
data PinCapabilities
DigitalIO :: PinCapabilities
AnalogInput :: PinCapabilities
PWM :: PinCapabilities
mkInput :: MkInputSource ctx t -> GenSketch ctx (Behavior t)
data MkInputSource ctx t
InputSource :: [CChunk] -> [CChunk] -> Map ctx PinMode -> [CChunk] -> Stream t -> MkInputSource ctx t
[defineVar] :: MkInputSource ctx t -> [CChunk]
[setupInput] :: MkInputSource ctx t -> [CChunk]
[inputPinmode] :: MkInputSource ctx t -> Map ctx PinMode
[readInput] :: MkInputSource ctx t -> [CChunk]
[inputStream] :: MkInputSource ctx t -> Stream t
mkCChunk :: [CLine] -> [CChunk]
newtype CLine
CLine :: String -> CLine
[fromCLine] :: CLine -> String
data Delay
Delay :: Delay
defineTriggerAlias :: String -> GenFramework ctx -> GenSketch ctx (GenFramework ctx, String)
getTriggerLimit :: TriggerLimit -> Behavior Bool
data TriggerLimit
TriggerLimit :: Behavior Bool -> TriggerLimit
NoTriggerLimit :: TriggerLimit
newtype UniqueIds
UniqueIds :: Map String Integer -> UniqueIds
newtype CChunk
CChunk :: [CLine] -> CChunk
type family BehaviorToEvent a
type family HasPinCapability (c :: t) (list :: [t]) :: Bool
type family SameCapability (a :: PinCapabilities) (b :: PinCapabilities) :: Bool
newtype UniqueId
UniqueId :: Integer -> UniqueId
evalSketch :: Context ctx => GenSketch ctx a -> (Maybe Spec, GenFramework ctx)
getUniqueId :: String -> GenSketch ctx UniqueId
uniqueName :: String -> UniqueId -> String
uniqueName' :: String -> UniqueId -> String
instance Sketch.FRP.Copilot.Types.Context Copilot.Arduino.Internals.Arduino
instance GHC.Classes.Eq Copilot.Arduino.Internals.Arduino
instance forall k (t :: k). GHC.Classes.Eq (Copilot.Arduino.Internals.Pin t)
instance Sketch.FRP.Copilot.Types.IsDigitalIOPin t => Sketch.FRP.Copilot.Types.Input Copilot.Arduino.Internals.Arduino (Copilot.Arduino.Internals.Pin t) GHC.Types.Bool
instance Sketch.FRP.Copilot.Types.IsAnalogInputPin t => Sketch.FRP.Copilot.Types.Input Copilot.Arduino.Internals.Arduino (Copilot.Arduino.Internals.Pin t) Copilot.Arduino.Internals.ADC
instance GHC.Classes.Ord Copilot.Arduino.Internals.Arduino
instance forall k (t :: k). GHC.Classes.Ord (Copilot.Arduino.Internals.Pin t)
instance Sketch.FRP.Copilot.Types.Output Copilot.Arduino.Internals.Arduino Sketch.FRP.Copilot.Delay Sketch.FRP.Copilot.MicroSeconds
instance Sketch.FRP.Copilot.Types.Output Copilot.Arduino.Internals.Arduino Sketch.FRP.Copilot.Delay Sketch.FRP.Copilot.MilliSeconds
instance Sketch.FRP.Copilot.Types.IsDigitalIOPin t => Sketch.FRP.Copilot.Types.Output Copilot.Arduino.Internals.Arduino (Copilot.Arduino.Internals.Pin t) (Sketch.FRP.Copilot.Types.Event () (Copilot.Language.Stream.Stream GHC.Types.Bool))
instance Sketch.FRP.Copilot.Types.IsPWMPin t => Sketch.FRP.Copilot.Types.Output Copilot.Arduino.Internals.Arduino (Copilot.Arduino.Internals.Pin t) (Sketch.FRP.Copilot.Types.Event 'Sketch.FRP.Copilot.Types.PWM (Copilot.Language.Stream.Stream GHC.Internal.Word.Word8))
instance Copilot.Arduino.Internals.ShowCType GHC.Types.Bool
instance Copilot.Arduino.Internals.ShowCType GHC.Types.Double
instance Copilot.Arduino.Internals.ShowCType GHC.Types.Float
instance Copilot.Arduino.Internals.ShowCType GHC.Internal.Int.Int16
instance Copilot.Arduino.Internals.ShowCType GHC.Internal.Int.Int32
instance Copilot.Arduino.Internals.ShowCType GHC.Internal.Int.Int64
instance Copilot.Arduino.Internals.ShowCType GHC.Internal.Int.Int8
instance Copilot.Arduino.Internals.ShowCType GHC.Internal.Word.Word16
instance Copilot.Arduino.Internals.ShowCType GHC.Internal.Word.Word32
instance Copilot.Arduino.Internals.ShowCType GHC.Internal.Word.Word64
instance Copilot.Arduino.Internals.ShowCType GHC.Internal.Word.Word8
instance GHC.Internal.Show.Show Copilot.Arduino.Internals.Arduino
instance forall k (t :: k). GHC.Internal.Show.Show (Copilot.Arduino.Internals.Pin t)


-- | Programming the Arduino with Copilot, in functional reactive style.
--   
--   This module should work on any model of Arduino. See
--   Copilot.Arduino.Uno and Copilot.Arduino.Nano for model-specific code.
--   
--   There are also libraries like Copilot.Arduino.Library.Serial to
--   support additional hardware.
module Copilot.Arduino

-- | Typically your Arduino program's main will be implemented using this.
--   For example:
--   
--   <pre>
--   {-# LANGUAGE RebindableSyntax #-}
--   
--   import Copilot.Arduino
--   
--   main = arduino $ do
--   led =: flashing
--   	delay =: MilliSeconds (constant 100)
--   </pre>
--   
--   Running this program compiles the <a>Sketch</a> into C code using
--   copilot, and writes it to a .ino file. That can be built and uploaded
--   to your Arduino using the Arduino IDE, or any other toolchain for
--   Arduino sketches.
--   
--   This also supports interpreting a <a>Sketch</a>, without loading it
--   onto an Arduino. Run the program with parameters "-i 4" to display
--   what it would do on the first 4 iterations. The output will look
--   something like this:
--   
--   <pre>
--   delay:         digitalWrite: 
--   (100)          (13,false)    
--   (100)          (13,true)     
--   (100)          (13,false)    
--   (100)          (13,true)     
--   </pre>
arduino :: Sketch () -> IO ()

-- | An Arduino sketch, implemented using Copilot.
--   
--   It's best to think of the <a>Sketch</a> as a description of the state
--   of the board at any point in time.
--   
--   Under the hood, the <a>Sketch</a> is run in a loop. On each iteration,
--   it first reads inputs and then updates outputs as needed.
--   
--   While it is a monad, a Sketch's outputs are not updated in any
--   particular order, because Copilot does not guarantee any order.
type Sketch = GenSketch Arduino

-- | A pin on the Arduino board.
--   
--   For definitions of pins like <a>pin12</a>, load a module such as
--   Copilot.Arduino.Uno, which provides the pins of a particular board.
--   
--   A type-level list indicates how a Pin can be used, so the haskell
--   compiler will detect impossible uses of pins.
data Pin (t :: k)

-- | Indicates that you're programming an arduino, and not some other kind
--   of hardware. The similar library zephyr-copilot allows programming
--   other embedded boards in a very similar style to this one.
data Arduino
type Behavior t = Stream t
data TypedBehavior (p :: k) t
TypedBehavior :: Behavior t -> TypedBehavior (p :: k) t
data Event (p :: k) v
(@:) :: IsBehavior behavior => behavior -> Behavior Bool -> BehaviorToEvent behavior
class Input ctx o t
input :: Input ctx o t => o -> GenSketch ctx (Behavior t)
input' :: Input ctx o t => o -> [t] -> GenSketch ctx (Behavior t)

-- | Normally when a digital value is read from a <a>Pin</a>, it is
--   configured without the internal pullup resistor being enabled. Use
--   this to enable the pullup register for all reads from the <a>Pin</a>.
--   
--   Bear in mind that enabling the pullup resistor inverts the value that
--   will be read from the pin.
--   
--   <pre>
--   pullup pin12
--   </pre>
pullup :: forall (t :: [PinCapabilities]). IsDigitalIOPin t => Pin t -> Sketch ()

-- | Number of MillisSeconds since the Arduino booted.
--   
--   <pre>
--   n &lt;- input millis
--   </pre>
--   
--   The value wraps back to zero after approximately 50 days.
millis :: ClockMillis

-- | Number of MicroSeconds since the Arduino booted.
--   
--   <pre>
--   n &lt;- input micros
--   </pre>
--   
--   The value wraps back to zero after approximately 70 minutes.
micros :: ClockMicros
class Output ctx o t

-- | The on-board LED.
led :: Pin '[ 'DigitalIO]
(=:) :: Output ctx o t => o -> t -> GenSketch ctx ()

-- | Use this to do PWM output to a pin.
--   
--   <pre>
--   pin3 =: pwm (constant 128)
--   </pre>
--   
--   Each Word8 of the Behavior describes a PWM square wave. 0 is always
--   off and 255 is always on.
pwm :: Behavior Word8 -> TypedBehavior 'PWM Word8
delay :: Delay

-- | Value read from an Arduino's ADC. Ranges from 0-1023.
type ADC = Int16
data MilliSeconds
MilliSeconds :: Stream Word32 -> MilliSeconds
data MicroSeconds
MicroSeconds :: Stream Word32 -> MicroSeconds
data ClockMillis
data ClockMicros
type family IsDigitalIOPin (t :: [PinCapabilities])
type family IsAnalogInputPin (t :: [PinCapabilities])
type family IsPWMPin (t :: [PinCapabilities])
blinking :: Behavior Bool
firstIteration :: Behavior Bool
frequency :: Integer -> Behavior Bool
sketchSpec :: Context ctx => GenSketch ctx a -> Spec
liftB :: (Behavior a -> Behavior r) -> TypedBehavior t a -> Behavior r
liftB2 :: (Behavior a -> Behavior b -> Behavior r) -> TypedBehavior t a -> TypedBehavior t b -> Behavior r
whenB :: Context ctx => Behavior Bool -> GenSketch ctx t -> GenSketch ctx t
scheduleB :: (Typed t, Eq t, Context ctx) => Behavior t -> [(t, GenSketch ctx ())] -> GenSketch ctx ()
ifThenElse :: IfThenElse t a => Behavior Bool -> t a -> t a -> t a
class IfThenElse (t :: Type -> Type) a
data Stream a
array :: forall (n :: Nat) t. KnownNat n => [t] -> Array n t
label :: Typed a => String -> Stream a -> Stream a
(.) :: (b -> c) -> (a -> b) -> a -> c
class Num a
(+) :: Num a => a -> a -> a
(-) :: Num a => a -> a -> a
(*) :: Num a => a -> a -> a
negate :: Num a => a -> a
abs :: Num a => a -> a
signum :: Num a => a -> a
fromInteger :: Num a => Integer -> a
class Show a
showsPrec :: Show a => Int -> a -> ShowS
show :: Show a => a -> String
showList :: Show a => [a] -> ShowS
type Spec = Writer [SpecItem] ()
data Maybe a
Nothing :: Maybe a
Just :: a -> Maybe a
interpret :: Integer -> Spec -> IO ()
reify :: Spec' a -> IO Spec
data IO a
type FilePath = String
class Functor f => Applicative (f :: Type -> Type)
pure :: Applicative f => a -> f a
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
(*>) :: Applicative f => f a -> f b -> f b
(<*) :: Applicative f => f a -> f b -> f a
class Eq a
class Eq a => Ord a
compare :: Ord a => a -> a -> Ordering
data Int16
data Type a
[Bool] :: Type Bool
[Int8] :: Type Int8
[Int16] :: Type Int16
[Int32] :: Type Int32
[Int64] :: Type Int64
[Word8] :: Type Word8
[Word16] :: Type Word16
[Word32] :: Type Word32
[Word64] :: Type Word64
[Float] :: Type Float
[Double] :: Type Double
[Array] :: forall (n :: Nat) t. (KnownNat n, Typed t) => Type t -> Type (Array n t)
[Struct] :: forall a. (Typed a, Struct a) => a -> Type a
data Bool
False :: Bool
True :: Bool
class Semigroup a
(<>) :: Semigroup a => a -> a -> a
($) :: (a -> b) -> a -> b
trigger :: String -> Stream Bool -> [Arg] -> Spec
arg :: Typed a => Stream a -> Arg
constant :: Typed a => a -> Stream a
data Word8
class Semigroup a => Monoid a
mempty :: Monoid a => a
mappend :: Monoid a => a -> a -> a
mconcat :: Monoid a => [a] -> a
extern :: Typed a => String -> Maybe [a] -> Stream a
class Foldable (t :: Type -> Type)
foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
null :: Foldable t => t a -> Bool
length :: Foldable t => t a -> Int
elem :: (Foldable t, Eq a) => a -> t a -> Bool
maximum :: (Foldable t, Ord a) => t a -> a
minimum :: (Foldable t, Ord a) => t a -> a
product :: (Foldable t, Num a) => t a -> a
otherwise :: Bool
type String = [Char]
data Int8
data Int32
data Int64
data Word16
data Word32
data Word64
data Float
data Double
($!) :: (a -> b) -> a -> b
(=<<) :: Monad m => (a -> m b) -> m a -> m b
asTypeOf :: a -> a -> a
flip :: (a -> b -> c) -> b -> a -> c
id :: a -> a
until :: Integral a => a -> Stream Bool -> Stream Bool -> Stream Bool
either :: (a -> c) -> (b -> c) -> Either a b -> c
all :: Foldable t => (a -> Bool) -> t a -> Bool
and :: Foldable t => t Bool -> Bool
any :: Foldable t => (a -> Bool) -> t a -> Bool
concat :: Foldable t => t [a] -> [a]
concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
or :: Foldable t => t Bool -> Bool
sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
(<$>) :: Functor f => (a -> b) -> f a -> f b
maybe :: b -> (a -> b) -> Maybe a -> b
lines :: String -> [String]
unlines :: [String] -> String
unwords :: [String] -> String
words :: String -> [String]
curry :: ((a, b) -> c) -> a -> b -> c
fst :: (a, b) -> a
snd :: (a, b) -> b
uncurry :: (a -> b -> c) -> (a, b) -> c
error :: HasCallStack => [Char] -> a
errorWithoutStackTrace :: [Char] -> a
undefined :: HasCallStack => a
ioError :: IOError -> IO a
userError :: String -> IOError
(!!) :: forall (n :: Nat) t. Stream (Array n t) -> Stream Word32 -> Projection (Array n t) (Stream Word32) t
break :: (a -> Bool) -> [a] -> ([a], [a])
cycle :: Typed a => [a] -> Stream a
drop :: Typed a => Int -> Stream a -> Stream a
dropWhile :: (a -> Bool) -> [a] -> [a]
head :: HasCallStack => [a] -> a
init :: HasCallStack => [a] -> [a]
iterate :: (a -> a) -> a -> [a]
last :: HasCallStack => [a] -> a
lookup :: Eq a => a -> [(a, b)] -> Maybe b
repeat :: a -> [a]
replicate :: Int -> a -> [a]
reverse :: [a] -> [a]
scanl :: (b -> a -> b) -> b -> [a] -> [b]
scanl1 :: (a -> a -> a) -> [a] -> [a]
scanr :: (a -> b -> b) -> b -> [a] -> [b]
scanr1 :: (a -> a -> a) -> [a] -> [a]
span :: (a -> Bool) -> [a] -> ([a], [a])
splitAt :: Int -> [a] -> ([a], [a])
tail :: HasCallStack => [a] -> [a]
take :: (Integral a, Typed b) => a -> Stream b -> [Stream b]
takeWhile :: (a -> Bool) -> [a] -> [a]
unzip :: [(a, b)] -> ([a], [b])
unzip3 :: [(a, b, c)] -> ([a], [b], [c])
zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
subtract :: Num a => a -> a -> a
lex :: ReadS String
readParen :: Bool -> ReadS a -> ReadS a
(^) :: (Typed a, Typed b, Num a, Bits a, Integral b) => Stream a -> Stream b -> Stream a
(^^) :: (Fractional a, Integral b) => a -> b -> a
even :: Integral a => a -> Bool
gcd :: Integral a => a -> a -> a
lcm :: Integral a => a -> a -> a
odd :: Integral a => a -> Bool
showChar :: Char -> ShowS
showParen :: Bool -> ShowS -> ShowS
showString :: String -> ShowS
shows :: Show a => a -> ShowS
appendFile :: FilePath -> String -> IO ()
getChar :: IO Char
getContents :: IO String
getLine :: IO String
interact :: (String -> String) -> IO ()
putChar :: Char -> IO ()
putStr :: String -> IO ()
putStrLn :: String -> IO ()
readFile :: FilePath -> IO String
readIO :: Read a => String -> IO a
readLn :: Read a => IO a
writeFile :: FilePath -> String -> IO ()
read :: Read a => String -> a
reads :: Read a => ReadS a
(&&) :: Stream Bool -> Stream Bool -> Stream Bool
not :: Stream Bool -> Stream Bool
(||) :: Stream Bool -> Stream Bool -> Stream Bool
class Functor (f :: Type -> Type)
fmap :: Functor f => (a -> b) -> f a -> f b
(<$) :: Functor f => a -> f b -> f a
sum :: (Typed a, Num a, Eq a) => Int -> Stream a -> Stream a
class (Functor t, Foldable t) => Traversable (t :: Type -> Type)
traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)
class Bounded a
minBound :: Bounded a => a
maxBound :: Bounded a => a
class Enum a
succ :: Enum a => a -> a
pred :: Enum a => a -> a
toEnum :: Enum a => Int -> a
fromEnum :: Enum a => a -> Int
enumFrom :: Enum a => a -> [a]
enumFromThen :: Enum a => a -> a -> [a]
enumFromTo :: Enum a => a -> a -> [a]
enumFromThenTo :: Enum a => a -> a -> a -> [a]
class Fractional a => Floating a
pi :: Floating a => a
exp :: Floating a => a -> a
log :: Floating a => a -> a
sqrt :: Floating a => a -> a
(**) :: Floating a => a -> a -> a
logBase :: Floating a => a -> a -> a
sin :: Floating a => a -> a
cos :: Floating a => a -> a
tan :: Floating a => a -> a
asin :: Floating a => a -> a
acos :: Floating a => a -> a
atan :: Floating a => a -> a
sinh :: Floating a => a -> a
cosh :: Floating a => a -> a
tanh :: Floating a => a -> a
asinh :: Floating a => a -> a
acosh :: Floating a => a -> a
atanh :: Floating a => a -> a
class (RealFrac a, Floating a) => RealFloat a
floatRadix :: RealFloat a => a -> Integer
floatDigits :: RealFloat a => a -> Int
floatRange :: RealFloat a => a -> (Int, Int)
decodeFloat :: RealFloat a => a -> (Integer, Int)
encodeFloat :: RealFloat a => Integer -> Int -> a
exponent :: RealFloat a => a -> Int
significand :: RealFloat a => a -> a
scaleFloat :: RealFloat a => Int -> a -> a
isNaN :: RealFloat a => a -> Bool
isInfinite :: RealFloat a => a -> Bool
isDenormalized :: RealFloat a => a -> Bool
isNegativeZero :: RealFloat a => a -> Bool
isIEEE :: RealFloat a => a -> Bool
atan2 :: RealFloat a => a -> a -> a
type IOError = IOException
class Read a
readsPrec :: Read a => Int -> ReadS a
readList :: Read a => ReadS [a]
class Num a => Fractional a
(/) :: Fractional a => a -> a -> a
recip :: Fractional a => a -> a
fromRational :: Fractional a => Rational -> a
div :: (Typed a, Integral a) => Stream a -> Stream a -> Stream a
class (Real a, Enum a) => Integral a
quot :: Integral a => a -> a -> a
rem :: Integral a => a -> a -> a
quotRem :: Integral a => a -> a -> (a, a)
divMod :: Integral a => a -> a -> (a, a)
toInteger :: Integral a => a -> Integer
mod :: (Typed a, Integral a) => Stream a -> Stream a -> Stream a
class (Real a, Fractional a) => RealFrac a
properFraction :: (RealFrac a, Integral b) => a -> (b, a)
truncate :: (RealFrac a, Integral b) => a -> b
round :: (RealFrac a, Integral b) => a -> b
ceiling :: (RealFrac a, Integral b) => a -> b
floor :: (RealFrac a, Integral b) => a -> b
type ShowS = String -> String
type ReadS a = String -> [(a, String)]
(/=) :: (Eq a, Typed a) => Stream a -> Stream a -> Stream Bool
(<) :: (Ord a, Typed a) => Stream a -> Stream a -> Stream Bool
(<=) :: (Ord a, Typed a) => Stream a -> Stream a -> Stream Bool
(>) :: (Ord a, Typed a) => Stream a -> Stream a -> Stream Bool
max :: (Typed a, Ord a) => Int -> Stream a -> Stream a
min :: (Typed a, Ord a) => Int -> Stream a -> Stream a
(==>) :: Stream Bool -> Stream Bool -> Stream Bool
data Char
data Int
data Word
data Ordering
LT :: Ordering
EQ :: Ordering
GT :: Ordering
class a ~# b => (a :: k) ~ (b :: k)
data Integer
(++) :: Typed a => [a] -> Stream a -> Stream a
map :: (a -> b) -> [a] -> [b]
class Applicative m => Monad (m :: Type -> Type)
(>>=) :: Monad m => m a -> (a -> m b) -> m b
(>>) :: Monad m => m a -> m b -> m b
return :: Monad m => a -> m a
data Either a b
Left :: a -> Either a b
Right :: b -> Either a b
zip :: [a] -> [b] -> [(a, b)]
filter :: (a -> Bool) -> [a] -> [a]
realToFrac :: (Real a, Fractional b) => a -> b
fromIntegral :: (Integral a, Num b) => a -> b
class (Num a, Ord a) => Real a
toRational :: Real a => a -> Rational
type Rational = Ratio Integer
print :: Show a => a -> IO ()
(==) :: (Eq a, Typed a) => Stream a -> Stream a -> Stream Bool
(>=) :: (Ord a, Typed a) => Stream a -> Stream a -> Stream Bool
class (Show a, Typeable a) => Typed a
typeOf :: Typed a => Type a
simpleType :: Typed a => Type a -> SimpleType
mux :: Typed a => Stream Bool -> Stream a -> Stream a -> Stream a
false :: Stream Bool
true :: Stream Bool
copilotMain :: Interpreter -> Printer -> Compiler -> Spec -> IO ()
defaultMain :: Compiler -> Spec -> IO ()
accessorName :: forall a (s :: Symbol) t. (Struct a, KnownSymbol s) => (a -> Field s t) -> String
fieldName :: forall (s :: Symbol) t. KnownSymbol s => Field s t -> String
toValuesDefault :: (Generic a, GStruct (Rep a)) => a -> [Value a]
typeLength :: forall (n :: Nat) t. KnownNat n => Type (Array n t) -> Int
typeNameDefault :: (Generic a, GDatatype (Rep a)) => a -> String
typeOfDefault :: (Typed a, Struct a, Generic a, GTypedStruct (Rep a)) => Type a
typeSize :: forall (n :: Nat) t. KnownNat n => Type (Array n t) -> Int
updateFieldDefault :: (Generic a, GStruct (Rep a)) => a -> Value t -> a
arrayElems :: forall (n :: Nat) a. Array n a -> [a]
arrayUpdate :: forall (n :: Nat) a. Array n a -> Int -> a -> Array n a
badUsage :: String -> a
impossible :: String -> String -> a
csv :: Integer -> Spec -> IO ()
(!) :: forall (n :: Nat) t. (KnownNat n, Typed t) => Stream (Array n t) -> Stream Word32 -> Stream t
(.<<.) :: (Bits a, Typed a, Typed b, Integral b) => Stream a -> Stream b -> Stream a
(.>>.) :: (Bits a, Typed a, Typed b, Integral b) => Stream a -> Stream b -> Stream a
xor :: Stream Bool -> Stream Bool -> Stream Bool
constB :: Bool -> Stream Bool
constD :: Double -> Stream Double
constF :: Float -> Stream Float
constI16 :: Int16 -> Stream Int16
constI32 :: Int32 -> Stream Int32
constI64 :: Int64 -> Stream Int64
constI8 :: Int8 -> Stream Int8
constW16 :: Word16 -> Stream Word16
constW32 :: Word32 -> Stream Word32
constW64 :: Word64 -> Stream Word64
constW8 :: Word8 -> Stream Word8
externB :: String -> Maybe [Bool] -> Stream Bool
externD :: String -> Maybe [Double] -> Stream Double
externF :: String -> Maybe [Float] -> Stream Float
externI16 :: String -> Maybe [Int16] -> Stream Int16
externI32 :: String -> Maybe [Int32] -> Stream Int32
externI64 :: String -> Maybe [Int64] -> Stream Int64
externI8 :: String -> Maybe [Int8] -> Stream Int8
externW16 :: String -> Maybe [Word16] -> Stream Word16
externW32 :: String -> Maybe [Word32] -> Stream Word32
externW64 :: String -> Maybe [Word64] -> Stream Word64
externW8 :: String -> Maybe [Word8] -> Stream Word8
local :: (Typed a, Typed b) => Stream a -> (Stream a -> Stream b) -> Stream b
(#) :: forall (f :: Symbol) t s. (KnownSymbol f, Typed t, Typed s, Struct s) => Stream s -> (s -> Field f t) -> Stream t
(##) :: forall (f :: Symbol) t s. (KnownSymbol f, Typed t, Typed s, Struct s) => Stream s -> (s -> Field f t) -> Projection s (s -> Field f t) t
exists :: Stream Bool -> Prop Existential
forAll :: Stream Bool -> Prop Universal
observer :: Typed a => String -> Stream a -> Spec
prop :: String -> Prop a -> Writer [SpecItem] (PropRef a)
theorem :: String -> Prop a -> Proof a -> Writer [SpecItem] (PropRef a)
clk :: Integral a => Period a -> Phase a -> Stream Bool
clk1 :: (Integral a, Typed a) => Period a -> Phase a -> Stream Bool
period :: Integral a => a -> Period a
phase :: Integral a => a -> Phase a
always :: Integral a => a -> Stream Bool -> Stream Bool
eventually :: Integral a => a -> Stream Bool -> Stream Bool
next :: Stream Bool -> Stream Bool
release :: Integral a => a -> Stream Bool -> Stream Bool -> Stream Bool
alwaysBeen :: Stream Bool -> Stream Bool
eventuallyPrev :: Stream Bool -> Stream Bool
previous :: Stream Bool -> Stream Bool
since :: Stream Bool -> Stream Bool -> Stream Bool
copilotRegexp :: (Typed t, SymbolParser t, Eq t) => Stream t -> SourceName -> Stream Bool -> Stream Bool
copilotRegexpB :: SourceName -> [(StreamName, Stream Bool)] -> Stream Bool -> Stream Bool
stack :: (Integral a, Typed b) => a -> b -> Stream Bool -> Stream Bool -> Stream b -> Stream b
stack' :: (Integral a, Typed b) => a -> b -> Stream Bool -> Stream Bool -> Stream b -> Stream b
mean :: (Typed a, Eq a, Fractional a) => Int -> Stream a -> Stream a
meanNow :: (Typed a, Integral a) => [Stream a] -> Stream a
(!!!) :: (Typed a, Eq b, Num b, Typed b) => [Stream a] -> Stream b -> Stream a
case' :: Typed a => [Stream Bool] -> [Stream a] -> Stream a
nfoldl :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream a) -> Stream a -> Stream b -> Stream a
nfoldl1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> Stream a
nfoldr :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream b) -> Stream b -> Stream a -> Stream b
nfoldr1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> Stream a
nscanl :: (Typed a, Typed b) => Int -> (Stream a -> Stream b -> Stream a) -> Stream a -> Stream b -> [Stream a]
nscanl1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> [Stream a]
nscanr :: Typed a => Int -> (Stream a -> Stream b -> Stream b) -> Stream b -> Stream a -> [Stream b]
nscanr1 :: Typed a => Int -> (Stream a -> Stream a -> Stream a) -> Stream a -> [Stream a]
tails :: Typed a => Stream a -> [Stream a]
aMajority :: (Eq a, Typed a) => [Stream a] -> Stream a -> Stream Bool
majority :: (Eq a, Typed a) => [Stream a] -> Stream a
(.^.) :: Bits a => a -> a -> a
bitReverse16 :: Word16 -> Word16
bitReverse32 :: Word32 -> Word32
bitReverse64 :: Word64 -> Word64
bitReverse8 :: Word8 -> Word8
byteSwap16 :: Word16 -> Word16
byteSwap32 :: Word32 -> Word32
byteSwap64 :: Word64 -> Word64
type Name = String
data Field (s :: Symbol) t
Field :: t -> Field (s :: Symbol) t
data SimpleType
[SBool] :: SimpleType
[SInt8] :: SimpleType
[SInt16] :: SimpleType
[SInt32] :: SimpleType
[SInt64] :: SimpleType
[SWord8] :: SimpleType
[SWord16] :: SimpleType
[SWord32] :: SimpleType
[SWord64] :: SimpleType
[SFloat] :: SimpleType
[SDouble] :: SimpleType
[SArray] :: forall t. Type t -> SimpleType
[SStruct] :: SimpleType
class Struct a
typeName :: Struct a => a -> String
toValues :: Struct a => a -> [Value a]
updateField :: Struct a => a -> Value t -> a
data Array (n :: Nat) t
data UType
UType :: Type a -> UType
data Value a
Value :: Type t -> Field s t -> Value a
class Cast a b
cast :: Cast a b => Stream a -> Stream b
class UnsafeCast a b
unsafeCast :: UnsafeCast a b => Stream a -> Stream b
class Projectable d s t | d s -> t where {
    data Projection d s t;
}
(=$) :: Projectable d s t => Projection d s t -> (Stream t -> Stream t) -> Stream d
data family Projection d s t
class Eq a => Bits a
(.&.) :: Bits a => a -> a -> a
(.|.) :: Bits a => a -> a -> a
complement :: Bits a => a -> a
class Monad m => MonadFail (m :: Type -> Type)
fail :: MonadFail m => String -> m a
seq :: a -> b -> b
instance Sketch.FRP.Copilot.Types.Input Copilot.Arduino.Internals.Arduino Copilot.Arduino.ClockMicros GHC.Internal.Word.Word32
instance Sketch.FRP.Copilot.Types.Input Copilot.Arduino.Internals.Arduino Copilot.Arduino.ClockMillis GHC.Internal.Word.Word32


-- | This module be used to create a new module targeting a specific serial
--   device. See CoPilot.Arduino.Library.Serial and
--   CoPilot.Arduino.Library.Serial.XBee for examples.
module Copilot.Arduino.Library.Serial.Device

-- | Use this to output a Char.
char :: Char -> FormatOutput
class OutputString t

-- | Use this to output a <a>String</a> or <a>FlashString</a>
str :: OutputString t => t -> FormatOutput

-- | Normally a String will be copied into ram before it is output. A
--   FlashString will be output directly from flash memory.
--   
--   Using this with <a>str</a> will reduce the amount of memory used by
--   your program, but will likely slightly increase the size of the
--   program.
newtype FlashString
FlashString :: String -> FlashString

-- | Use this to show the current value of a Stream.
--   
--   Numbers will be formatted in decimal. Bool is displayed as 0 and 1.
show :: (ShowCType t, Typed t) => Stream t -> FormatOutput

-- | Show the current value of a Stream with control over the formatting.
--   
--   When used with a Float, provide the number of decimal places to show.
--   
--   <pre>
--   Serial.showFormatted (constant (1.234 :: Float)) 2 -- "1.23"
--   </pre>
--   
--   When used with any Integral type, provide the <a>Base</a> to display
--   it in
--   
--   <pre>
--   Serial.showFormatted (constant (78 :: Int8)) Serial.HEX -- "4E"
--   </pre>
showFormatted :: (ShowCType t, Typed t, FormatableType t f) => Stream t -> f -> FormatOutput

-- | Write a byte to the serial port.
byte :: Stream Int8 -> FormatOutput

-- | Write an array of bytes to the serial port.
byteArray :: forall (n :: Nat). KnownNat n => Stream (Array n Int8) -> FormatOutput

-- | Value that is read from serial port when there is no input available.
noInput :: Int8
newtype SerialDevice
SerialDevice :: SerialDeviceName -> SerialDevice
data FormatOutput
FormatOutput :: Maybe Arg -> Maybe String -> (SerialDeviceName -> String -> CLine) -> FormatOutput
[formatArg] :: FormatOutput -> Maybe Arg
[formatCType] :: FormatOutput -> Maybe String
[formatCLine] :: FormatOutput -> SerialDeviceName -> String -> CLine
class FormatableType (t :: k) f
formatter :: FormatableType t f => Proxy t -> f -> String
data Base
BIN :: Base
OCT :: Base
DEC :: Base
HEX :: Base

-- | Eg "Serial" or "Serial2"
newtype SerialDeviceName
SerialDeviceName :: String -> SerialDeviceName
newtype Baud
Baud :: Int -> Baud
baudD :: SerialDeviceName -> Int -> Sketch ()
configureD :: forall (rx :: [PinCapabilities]) (tx :: [PinCapabilities]). (IsDigitalIOPin rx, IsDigitalIOPin tx) => SerialDeviceName -> Pin rx -> Pin tx -> Baud -> Sketch ()
quoteString :: String -> String
type family IsDigitalIOPin (t :: [PinCapabilities])
instance GHC.Classes.Eq Copilot.Arduino.Library.Serial.Device.Baud
instance Copilot.Arduino.Library.Serial.Device.FormatableType GHC.Types.Float GHC.Types.Int
instance GHC.Internal.Real.Integral t => Copilot.Arduino.Library.Serial.Device.FormatableType t Copilot.Arduino.Library.Serial.Device.Base
instance Sketch.FRP.Copilot.Types.Input Copilot.Arduino.Internals.Arduino Copilot.Arduino.Library.Serial.Device.SerialDevice GHC.Internal.Int.Int8
instance Sketch.FRP.Copilot.Types.IsBehavior [Copilot.Arduino.Library.Serial.Device.FormatOutput]
instance Sketch.FRP.Copilot.Types.Output Copilot.Arduino.Internals.Arduino Copilot.Arduino.Library.Serial.Device.SerialDevice (Sketch.FRP.Copilot.Types.Event () [Copilot.Arduino.Library.Serial.Device.FormatOutput])
instance Sketch.FRP.Copilot.Types.Output Copilot.Arduino.Internals.Arduino Copilot.Arduino.Library.Serial.Device.SerialDevice [Copilot.Arduino.Library.Serial.Device.FormatOutput]
instance Copilot.Arduino.Library.Serial.Device.OutputString Copilot.Arduino.Library.Serial.Device.FlashString
instance Copilot.Arduino.Library.Serial.Device.OutputString GHC.Internal.Base.String
instance GHC.Internal.Show.Show Copilot.Arduino.Library.Serial.Device.Base
instance GHC.Internal.Show.Show Copilot.Arduino.Library.Serial.Device.Baud


-- | XBee serial library for arduino-copilot.
--   
--   This module is designed to be imported qualified as XBee
module Copilot.Arduino.Library.Serial.XBee
newtype Baud
Baud :: Int -> Baud

-- | Configure the XBee device.
--   
--   This must be included in your sketch if it uses XBee.
--   
--   <pre>
--   XBee.configure pin2 pin3 (XBee.Baud 9600)
--   </pre>
configure :: forall (rx :: [PinCapabilities]) (tx :: [PinCapabilities]). (IsDigitalIOPin rx, IsDigitalIOPin tx) => Pin rx -> Pin tx -> Baud -> Sketch ()

-- | Use this to communicate with the XBee, both input and output.
--   
--   To output to the XBee, simply connect this to a [<a>FormatOutput</a>]
--   that describes the serial output. Note that you can only do this once
--   in a Sketch.
--   
--   <pre>
--   main = arduino $ do
--      XBee.configure pin2 pin3 (XBee.Baud 9600)
--   	b &lt;- input pin4
--   	XBee.device =:
--   		[ Serial.str "pin4:"
--   		, Serial.show b
--   		, Serial.char '\n'
--   		]
--   </pre>
--   
--   To input from the XBee, use this with <a>input</a>.
--   
--   <pre>
--   userinput &lt;- input XBee.device
--   </pre>
--   
--   The resulting `Behavior Int8` will be updated on each iteration of the
--   sketch. When there is no new serial input available, it will contain
--   <a>noInput</a>.
device :: SerialDevice

-- | Use this to output a Char.
char :: Char -> FormatOutput

-- | Use this to output a <a>String</a> or <a>FlashString</a>
str :: OutputString t => t -> FormatOutput

-- | Normally a String will be copied into ram before it is output. A
--   FlashString will be output directly from flash memory.
--   
--   Using this with <a>str</a> will reduce the amount of memory used by
--   your program, but will likely slightly increase the size of the
--   program.
newtype FlashString
FlashString :: String -> FlashString

-- | Use this to show the current value of a Stream.
--   
--   Numbers will be formatted in decimal. Bool is displayed as 0 and 1.
show :: (ShowCType t, Typed t) => Stream t -> FormatOutput

-- | Show the current value of a Stream with control over the formatting.
--   
--   When used with a Float, provide the number of decimal places to show.
--   
--   <pre>
--   Serial.showFormatted (constant (1.234 :: Float)) 2 -- "1.23"
--   </pre>
--   
--   When used with any Integral type, provide the <a>Base</a> to display
--   it in
--   
--   <pre>
--   Serial.showFormatted (constant (78 :: Int8)) Serial.HEX -- "4E"
--   </pre>
showFormatted :: (ShowCType t, Typed t, FormatableType t f) => Stream t -> f -> FormatOutput

-- | Write a byte to the serial port.
byte :: Stream Int8 -> FormatOutput

-- | Write an array of bytes to the serial port.
byteArray :: forall (n :: Nat). KnownNat n => Stream (Array n Int8) -> FormatOutput

-- | Value that is read from serial port when there is no input available.
noInput :: Int8
data SerialDevice
data FormatOutput
class OutputString t
class FormatableType (t :: k) f
data Base
BIN :: Base
OCT :: Base
DEC :: Base
HEX :: Base


-- | Serial port library for arduino-copilot.
--   
--   This module is designed to be imported qualified as Serial
module Copilot.Arduino.Library.Serial

-- | Configure the baud rate of the serial port.
--   
--   This must be included in your sketch if it uses the serial port.
baud :: Int -> Sketch ()

-- | Use this to communicate with the serial port, both input and output.
--   
--   To output to the serial port, simply connect this to a
--   [<a>FormatOutput</a>] that describes the serial output.
--   
--   <pre>
--   main = arduino $ do
--   	Serial.baud 9600
--   	b &lt;- input pin4
--   	Serial.device =:
--   		[ Serial.str "pin4:"
--   		, Serial.show b
--   		, Serial.char '\n'
--   		]
--   </pre>
--   
--   You can output different things to a serial port at different times,
--   eg using <a>whenB</a>, but note that if multiple outputs are sent at
--   the same time, the actual order is not defined. This example may
--   output "world" before "hello"
--   
--   <pre>
--   Serial.device =: [Serial.str "hello "]
--   Serial.device =: [Serial.str "world"]
--   </pre>
--   
--   To input from the serial port, use this with <a>input</a>.
--   
--   <pre>
--   userinput &lt;- input Serial.device
--   </pre>
--   
--   The resulting `Behavior Int8` will be updated on each iteration of the
--   sketch. When there is no new serial input available, it will contain
--   <a>noInput</a>.
--   
--   Note: When a Sketch that does serial output is sumulated (with -i),
--   Copilot does not display the static strings (<a>str</a>) that are
--   output to the serial port, but it does output the changing values.
device :: SerialDevice

-- | Use this to output a Char.
char :: Char -> FormatOutput

-- | Use this to output a <a>String</a> or <a>FlashString</a>
str :: OutputString t => t -> FormatOutput

-- | Normally a String will be copied into ram before it is output. A
--   FlashString will be output directly from flash memory.
--   
--   Using this with <a>str</a> will reduce the amount of memory used by
--   your program, but will likely slightly increase the size of the
--   program.
newtype FlashString
FlashString :: String -> FlashString

-- | Use this to show the current value of a Stream.
--   
--   Numbers will be formatted in decimal. Bool is displayed as 0 and 1.
show :: (ShowCType t, Typed t) => Stream t -> FormatOutput

-- | Show the current value of a Stream with control over the formatting.
--   
--   When used with a Float, provide the number of decimal places to show.
--   
--   <pre>
--   Serial.showFormatted (constant (1.234 :: Float)) 2 -- "1.23"
--   </pre>
--   
--   When used with any Integral type, provide the <a>Base</a> to display
--   it in
--   
--   <pre>
--   Serial.showFormatted (constant (78 :: Int8)) Serial.HEX -- "4E"
--   </pre>
showFormatted :: (ShowCType t, Typed t, FormatableType t f) => Stream t -> f -> FormatOutput

-- | Write a byte to the serial port.
byte :: Stream Int8 -> FormatOutput

-- | Write an array of bytes to the serial port.
byteArray :: forall (n :: Nat). KnownNat n => Stream (Array n Int8) -> FormatOutput

-- | Value that is read from serial port when there is no input available.
noInput :: Int8
data SerialDevice
data FormatOutput
class OutputString t
class FormatableType (t :: k) f
data Base
BIN :: Base
OCT :: Base
DEC :: Base
HEX :: Base


-- | Random value library for arduino-copilot.
--   
--   Here's an example that flashes the LED randomly.
--   
--   <pre>
--   main :: IO ()
--   main = arduino $ do
--   if firstIteration
--   		then randomSeedPin a0
--   		else do
--   			n &lt;- input (random 10) :: Sketch (Behavior Word32)
--   			led =: (n &gt;= 5)
--   </pre>
--   
--   The use of <a>firstIteration</a> makes the RNG be seeded in the first
--   iteration, and then random numbers are generated in subsequent
--   iterations. That's a typical pattern when using this module.
module Copilot.Arduino.Library.Random

-- | Use this to seed the RNG.
--   
--   <pre>
--   randomSeed =: constant (1 :: Word8)
--   </pre>
randomSeed :: RandomSeed

-- | Seed the RNG by reading from an analog input pin.
--   
--   If the pin is left unconnected, noise will be read from it.
randomSeedPin :: forall (t :: [PinCapabilities]). IsAnalogInputPin t => Pin t -> Sketch ()
data RandomSeed
data RandomInput

-- | Generate a random number, up to but exclusive of an upper bound.
--   
--   <pre>
--   n &lt;- input (random 10)
--   </pre>
random :: Word32 -> RandomInput

-- | Generate a random number in the range (lo, hi). The number will be
--   <tt>&gt;= lo</tt> and <tt>&lt; hi</tt>
--   
--   <pre>
--   n &lt;- input (randomR 5 10) :: Sketch (Behavior Word32)
--   </pre>
randomR :: (Word32, Word32) -> RandomInput
instance Sketch.FRP.Copilot.Types.Input Copilot.Arduino.Internals.Arduino Copilot.Arduino.Library.Random.RandomInput GHC.Internal.Word.Word32
instance Sketch.FRP.Copilot.Types.Output Copilot.Arduino.Internals.Arduino Copilot.Arduino.Library.Random.RandomSeed (Sketch.FRP.Copilot.Types.Event () (Copilot.Language.Stream.Stream GHC.Internal.Word.Word8))
instance Sketch.FRP.Copilot.Types.Output Copilot.Arduino.Internals.Arduino Copilot.Arduino.Library.Random.RandomSeed (Sketch.FRP.Copilot.Types.Event () (Copilot.Language.Stream.Stream Copilot.Arduino.Internals.ADC))


-- | EEPROMex library for arduino-copilot.
--   
--   This module is designed to be imported qualified.
--   
--   This is an interface to the C EEPROMex library, which will need to be
--   installed in your Arduino development environment.
--   <a>https://playground.arduino.cc/Code/EEPROMex/</a>
module Copilot.Arduino.Library.EEPROMex

-- | Set the maximum number of writes to EEPROM that can be made while the
--   Arduino is running. When too many writes have been made, it will no
--   longer write to the EEPROM, and will send warning messages to the
--   serial port.
--   
--   This is a strongly encouraged safety measure to use, because the
--   Arduino's EEPROM can only endure around 100,000 writes, and a Sketch
--   that's constantly writing to EEPROM, without a well chosen <tt>:@</tt>
--   rate limit or <a>delay</a>, could damage your hardware in just a few
--   minutes.
--   
--   Note that this module uses EEPROMex's update facility for all writes
--   to EEPROM. That avoids writing a byte when its current value is the
--   same as what needed to be written. That prevents excessive wear in
--   some cases, but you should still use maxAllowedWrites too.
--   
--   For this to work, CPPFLAGS needs to include "-D_EEPROMEX_DEBUG" when
--   the EEPROMex C library gets built. When you use this, it generates C
--   code that makes sure that is enabled.
maxAllowedWrites :: Word16 -> Sketch ()

-- | Configure the EEPROM memory pool that the program can use.
--   
--   <pre>
--   EEPROM.memPool 0 (EndAddress sizeOfEEPROM)
--   </pre>
memPool :: StartAddress -> EndAddress -> Sketch ()

-- | The address of the first byte of the EEPROM that will be allocated by
--   <a>alloc</a>. The default is to start allocation from 0.
--   
--   Picking a different StartAddress can avoid overwriting the part of the
--   EEPROM that is used by some other program.
newtype StartAddress
StartAddress :: Word16 -> StartAddress

-- | The address of the last byte of the EEPROM that can be allocated by
--   <a>alloc</a>. The default is to allow allocating 512 bytes.
--   
--   Modules for particular boards, such as Copilot.Arduino.Library.Uno,
--   each define a sizeOfEEPROM value, so to use the entire EEPROM, use:
--   
--   <pre>
--   EndAddress sizeOfEEPROM
--   </pre>
newtype EndAddress
EndAddress :: Word16 -> EndAddress
class (ShowCType t, Typed t) => EEPROMable t

-- | Allocates a location in the EEPROM.
--   
--   Two things are returned; first a <a>Behavior</a> which contains a
--   value read from the EEPROM at boot; and secondly a <a>Location</a>
--   that can be written to later on.
--   
--   Here's an example of using it, to remember the maximum value read from
--   a1, persistently across power cycles.
--   
--   <pre>
--   EEPROM.maxAllowedWrites 100
--   (bootval, eepromloc) &lt;- EEPROM.alloc
--   currval &lt;- input a1 :: Sketch (Behavior ADC)
--   let maxval = [maxBound] ++ if currval &gt; bootval then currval else bootval
--   eepromloc =: currval @: (currval &gt; maxval)
--   delay =: MilliSeconds (constant 10000)
--   </pre>
--   
--   Of course, the EEPROM could already contain any value at the allocated
--   location to start with (either some default value or something written
--   by another program). So you'll need to first boot up a sketch that
--   zeros it out before using the sketch above. Here's a simple sketch
--   that zeros two values:
--   
--   <pre>
--   EEPROM.maxAllowedWrites 100
--   (_, eepromloc1) &lt;- EEPROM.alloc
--   (_, eepromloc2) &lt;- EEPROM.alloc
--   eepromloc1 =: constant (0 :: ADC) :@ firstIteration
--   eepromloc2 =: constant (0 :: Word16) :@ firstIteration
--   </pre>
--   
--   <a>alloc</a> can be used as many times as you want, storing multiple
--   values in the EEPROM, up to the limit of the size of the EEPROM.
--   (Which is not statically checked.)
--   
--   Do note that the EEPROM layout is controlled by the order of calls to
--   <a>alloc</a>, so take care when reordering or deleting calls.
alloc :: EEPROMable t => Sketch (Behavior t, Location t)

-- | Same as <a>alloc'</a>, but with a value which will be used as the
--   EEPROM's boot value when interpreting the Sketch, instead of the
--   default of acting as if all bits of the EEPROM are set.
alloc' :: EEPROMable t => t -> Sketch (Behavior t, Location t)
data Location t

-- | A range of values in the EEPROM.
data Range t

-- | An index into a Range. 0 is the first value in the Range.
--   
--   Indexes larger than the size of the Range will not overflow it,
--   instead they loop back to the start of the Range.
type RangeIndex = Word16

-- | Allocates a Range in the EEPROM, which stores the specified number of
--   items of some type.
--   
--   This is an example of using a range of the EEPROM as a ring buffer, to
--   store the last 100 values read from a1.
--   
--   <pre>
--   EEPROM.maxAllowedWrites 1000
--   range &lt;- EEPROM.allocRange 100 :: Sketch (EEPROM.Range ADC)
--   currval &lt;- input a1 :: Sketch (Behavior ADC)
--   range =: EEPROM.sweepRange 0 currval
--   delay =: MilliSeconds (constant 10000)
--   </pre>
--   
--   <a>allocRange</a> can be used as many times as you want, and combined
--   with uses of <a>alloc</a>, up to the size of the EEPROM. (Which is not
--   statically checked.)
--   
--   Do note that the EEPROM layout is controlled by the order of calls to
--   <a>allocRange</a> and <a>alloc</a>, so take care when reordering or
--   deleting calls.
allocRange :: EEPROMable t => Word16 -> Sketch (Range t)

-- | Treat the <a>Range</a> as a ring buffer, and starting with the
--   specified <a>RangeIndex</a>, sweep over the <a>Range</a> writing
--   values from the <a>Behavior</a>.
sweepRange :: RangeIndex -> Behavior t -> RangeWrites t

-- | This is actually just a simple counter that increments on each write
--   to the range. That's sufficient, because writes that overflow the end
--   of the range wrap back to the start.
sweepRange' :: RangeIndex -> Behavior Bool -> Behavior RangeIndex

-- | Description of writes made to a Range.
--   
--   This can be turned into an <a>Event</a> by using <a>@:</a> with it,
--   and that's what the Behavior Bool is needed for. Consider this
--   example, that ignores the Behavior Bool, and just uses a counter for
--   the <a>RangeIndex</a>:
--   
--   <pre>
--   range =: EEPROM.RangeWrites (\_ -&gt; counter) (constant 0) @: blinking
--   </pre>
--   
--   The use of <a>@:</a> <a>blinking</a> makes an <a>Event</a> that only
--   occurs on every other iteration of the Sketch. But, the counter
--   increases on every iteration of the Sketch. So that will only write to
--   every other value in the <a>Range</a>.
--   
--   The Behavior Bool is only True when an event occurs, and so it can be
--   used to avoid incrementing the counter otherwise. See
--   <a>sweepRange'</a> for an example.
data RangeWrites t
RangeWrites :: (Behavior Bool -> Behavior RangeIndex) -> Behavior t -> RangeWrites t

-- | Scan through the <a>Range</a>, starting with the specified
--   <a>RangeIndex</a>.
--   
--   <pre>
--   range &lt;- EEPROM.allocRange 100 :: Sketch (EEPROM.Range ADC)
--   v &lt;- input $ scanRange range 0
--   </pre>
--   
--   Once the end of the <a>Range</a> is reached, input continues from the
--   start of the <a>Range</a>.
--   
--   It's fine to write and read from the same range in the same Sketch,
--   but if the RangeIndex being read and written is the same, it's not
--   defined in what order the two operations will happen.
--   
--   Also, when interpreting a Sketch that both reads and writes to a
--   range, the input from that range won't reflect the writes made to it,
--   but will instead come from the list of values passed to <a>input'</a>.
scanRange :: Range t -> RangeIndex -> RangeReads t

-- | Description of how to read a` Range`.
--   
--   The first read is made at the specified RangeIndex, and the location
--   to read from subsequently comes from the Behavior RangeIndex.
data RangeReads t
RangeReads :: Range t -> RangeIndex -> Behavior RangeIndex -> RangeReads t
instance GHC.Internal.Enum.Bounded Copilot.Arduino.Library.EEPROMex.EndAddress
instance GHC.Internal.Enum.Bounded Copilot.Arduino.Library.EEPROMex.StartAddress
instance Copilot.Arduino.Library.EEPROMex.EEPROMable GHC.Types.Bool
instance Copilot.Arduino.Library.EEPROMex.EEPROMable GHC.Types.Double
instance Copilot.Arduino.Library.EEPROMex.EEPROMable GHC.Types.Float
instance Copilot.Arduino.Library.EEPROMex.EEPROMable GHC.Internal.Int.Int16
instance Copilot.Arduino.Library.EEPROMex.EEPROMable GHC.Internal.Int.Int32
instance Copilot.Arduino.Library.EEPROMex.EEPROMable GHC.Internal.Int.Int8
instance Copilot.Arduino.Library.EEPROMex.EEPROMable GHC.Internal.Word.Word16
instance Copilot.Arduino.Library.EEPROMex.EEPROMable GHC.Internal.Word.Word32
instance Copilot.Arduino.Library.EEPROMex.EEPROMable GHC.Internal.Word.Word8
instance GHC.Internal.Enum.Enum Copilot.Arduino.Library.EEPROMex.EndAddress
instance GHC.Internal.Enum.Enum Copilot.Arduino.Library.EEPROMex.StartAddress
instance GHC.Classes.Eq Copilot.Arduino.Library.EEPROMex.EndAddress
instance GHC.Classes.Eq Copilot.Arduino.Library.EEPROMex.StartAddress
instance (Copilot.Arduino.Internals.ShowCType t, Copilot.Arduino.Library.EEPROMex.EEPROMable t) => Sketch.FRP.Copilot.Types.Input Copilot.Arduino.Internals.Arduino (Copilot.Arduino.Library.EEPROMex.RangeReads t) t
instance GHC.Internal.Real.Integral Copilot.Arduino.Library.EEPROMex.EndAddress
instance GHC.Internal.Real.Integral Copilot.Arduino.Library.EEPROMex.StartAddress
instance Copilot.Arduino.Library.EEPROMex.EEPROMable t => Sketch.FRP.Copilot.Types.IsBehavior (Copilot.Arduino.Library.EEPROMex.RangeWrites t)
instance GHC.Internal.Num.Num Copilot.Arduino.Library.EEPROMex.EndAddress
instance GHC.Internal.Num.Num Copilot.Arduino.Library.EEPROMex.StartAddress
instance GHC.Classes.Ord Copilot.Arduino.Library.EEPROMex.EndAddress
instance GHC.Classes.Ord Copilot.Arduino.Library.EEPROMex.StartAddress
instance Copilot.Arduino.Library.EEPROMex.EEPROMable t => Sketch.FRP.Copilot.Types.Output Copilot.Arduino.Internals.Arduino (Copilot.Arduino.Library.EEPROMex.Location t) (Sketch.FRP.Copilot.Types.Event () (Copilot.Language.Stream.Stream t))
instance Copilot.Arduino.Library.EEPROMex.EEPROMable t => Sketch.FRP.Copilot.Types.Output Copilot.Arduino.Internals.Arduino (Copilot.Arduino.Library.EEPROMex.Range t) (Sketch.FRP.Copilot.Types.Event () (Copilot.Arduino.Library.EEPROMex.RangeWrites t))
instance Copilot.Arduino.Library.EEPROMex.EEPROMable t => Sketch.FRP.Copilot.Types.Output Copilot.Arduino.Internals.Arduino (Copilot.Arduino.Library.EEPROMex.Range t) (Copilot.Arduino.Library.EEPROMex.RangeWrites t)
instance GHC.Internal.Read.Read Copilot.Arduino.Library.EEPROMex.EndAddress
instance GHC.Internal.Read.Read Copilot.Arduino.Library.EEPROMex.StartAddress
instance GHC.Internal.Real.Real Copilot.Arduino.Library.EEPROMex.EndAddress
instance GHC.Internal.Real.Real Copilot.Arduino.Library.EEPROMex.StartAddress
instance GHC.Internal.Show.Show Copilot.Arduino.Library.EEPROMex.EndAddress
instance GHC.Internal.Show.Show Copilot.Arduino.Library.EEPROMex.StartAddress


-- | Programming the Arduino Nano with Copilot.
module Copilot.Arduino.Nano
pin2 :: Pin '[ 'DigitalIO]
pin3 :: Pin '[ 'DigitalIO, 'PWM]
pin4 :: Pin '[ 'DigitalIO]
pin5 :: Pin '[ 'DigitalIO, 'PWM]
pin6 :: Pin '[ 'DigitalIO, 'PWM]
pin7 :: Pin '[ 'DigitalIO]
pin8 :: Pin '[ 'DigitalIO]
pin9 :: Pin '[ 'DigitalIO, 'PWM]
pin10 :: Pin '[ 'DigitalIO, 'PWM]
pin11 :: Pin '[ 'DigitalIO, 'PWM]
pin12 :: Pin '[ 'DigitalIO]

-- | This pin is connected to the <a>led</a>
pin13 :: Pin '[ 'DigitalIO]
a0 :: Pin '[ 'AnalogInput, 'DigitalIO]
a1 :: Pin '[ 'AnalogInput, 'DigitalIO]
a2 :: Pin '[ 'AnalogInput, 'DigitalIO]
a3 :: Pin '[ 'AnalogInput, 'DigitalIO]
a4 :: Pin '[ 'AnalogInput, 'DigitalIO]
a5 :: Pin '[ 'AnalogInput, 'DigitalIO]

-- | Limited to analog input.
a6 :: Pin '[ 'AnalogInput]

-- | Limited to analog input.
a7 :: Pin '[ 'AnalogInput]

-- | Different versions of Arduino Nano have different EEPROM sizes. This
--   is a safe value that will work on all versions.
sizeOfEEPROM :: Word16


-- | Programming the Arduino Uno with Copilot.
module Copilot.Arduino.Uno
pin2 :: Pin '[ 'DigitalIO]
pin3 :: Pin '[ 'DigitalIO, 'PWM]
pin4 :: Pin '[ 'DigitalIO]
pin5 :: Pin '[ 'DigitalIO, 'PWM]
pin6 :: Pin '[ 'DigitalIO, 'PWM]
pin7 :: Pin '[ 'DigitalIO]
pin8 :: Pin '[ 'DigitalIO]
pin9 :: Pin '[ 'DigitalIO, 'PWM]
pin10 :: Pin '[ 'DigitalIO, 'PWM]
pin11 :: Pin '[ 'DigitalIO, 'PWM]
pin12 :: Pin '[ 'DigitalIO]

-- | This pin drives the <a>led</a>
pin13 :: Pin '[ 'DigitalIO]
a0 :: Pin '[ 'AnalogInput, 'DigitalIO]
a1 :: Pin '[ 'AnalogInput, 'DigitalIO]
a2 :: Pin '[ 'AnalogInput, 'DigitalIO]
a3 :: Pin '[ 'AnalogInput, 'DigitalIO]
a4 :: Pin '[ 'AnalogInput, 'DigitalIO]
a5 :: Pin '[ 'AnalogInput, 'DigitalIO]
sizeOfEEPROM :: Word16
