Skip to content

Instantly share code, notes, and snippets.

@Mokosha
Last active August 29, 2015 14:01
Show Gist options
  • Save Mokosha/2b65655450981cfded65 to your computer and use it in GitHub Desktop.
Save Mokosha/2b65655450981cfded65 to your computer and use it in GitHub Desktop.
Leaking Netwire Program
module Main where
import Control.Wire
mkWire :: (Num b, HasTime t s, Show b, Monad m) => b -> Wire s () m a b
mkWire x = ((pure x) &&& (periodic 2) >>> Control.Wire.until) --> (mkWire (x + 1))
main :: IO ()
main = testWire clockSession_ (mkWire 3)
@Mokosha
Copy link
Author

Mokosha commented May 17, 2014

The semantics of this wire can be expressed better as:

mkWire x = pure x >>> (for 2) --> mkWire (x + 1)

However, I'd like to know why the wire that I've posted explodes w.r.t. memory.

@Mokosha
Copy link
Author

Mokosha commented May 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment