Safe Haskell | None |
---|---|

Language | Haskell2010 |

- data Signal a
- signal :: a -> Signal a
- register :: a -> Signal a -> Signal a
- class Pack a where
- (<^) :: Applicative f => f a -> (a -> b -> c) -> f b -> f c
- (^>) :: Applicative f => (f a -> f b) -> f a -> f b
- simulate :: (Signal a -> Signal b) -> [a] -> [b]
- simulateP :: (Pack a, Pack b) => (SignalP a -> SignalP b) -> [a] -> [b]
- sample :: Signal a -> [a]
- sampleN :: Int -> Signal a -> [a]
- fromList :: [a] -> Signal a

# Implicitly clocked synchronous signal

A synchronized signal with samples of type `a`

, implicitly synchronized to
an unnamed global clock

# Basic circuit functions

signal :: a -> Signal a Source

Create a constant `Signal`

from a combinational value

`>>>`

[4, 4, 4, 4, ...`sample (signal 4)`

Isomorphism between a `Signal`

of a product type (e.g. a tuple) and a
product type of `Signal`

s.

Instances of `Pack`

must satisfy the following laws:

pack . unpack =`id`

unpack . pack =`id`

(<^) :: Applicative f => f a -> (a -> b -> c) -> f b -> f c Source

Operator lifting, use in conjunction with (`^>`

)

add2 :: Signal Int -> Signal Int add2 x = x <^(+)^> (signal 2)

`>>>`

[3,4,5,...`simulate add2 [1,2,3,...`

(^>) :: Applicative f => (f a -> f b) -> f a -> f b Source

Operator lifting, use in conjunction with (`<^`

)

add2 :: Signal Int -> Signal Int add2 x = x <^(+)^> (signal 2)

`>>>`

[3,4,5,...`simulate add2 [1,2,3,...`