Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Let expressions.
Although Copilot is a DSL embedded in Haskell and Haskell does support let expressions, we want Copilot to be able to implement sharing, to detect when the same stream is being used in multiple places in a specification and avoid recomputing it unnecessarily.
Documentation
local :: (Typed a, Typed b) => Stream a -> (Stream a -> Stream b) -> Stream b Source #
Let expressions.
Create a stream that results from applying a stream to a function on
streams. Standard usage would be similar to Haskell's let. See the
following example, where stream1
, stream2
and s
are all streams
carrying values of some numeric type:
expression = local (stream1 + stream2) $ \s -> (s >= 0 && s <= 10)